INDIRECT Function in Excel

✨ Part 1. Introduce:
🔹 Definition: The INDIRECT Function in Microsoft Excel is a powerful built-in function that allows you to dynamically create a reference to a cell or range using a text string as input. It enables you to refer to cell addresses indirectly, meaning the cell address is determined by the content of a separate cell rather than being fixed in the formula itself.

🔹 Purpose: The primary purpose of the INDIRECT Function is to help you create flexible and dynamic formulas, especially when working with large datasets or referring to cells whose addresses change frequently.

🔹 Syntax & Arguments:

syntax
=INDIRECT(ref_text, [a1])
  • ref_text (required): This text string specifies the cell reference you want to create dynamically. It can be the address of a cell written as text or a cell reference containing the address.
  • a1 (optional): This argument is a logical value determining the reference type. If TRUE (or omitted), the ref_text is interpreted as an A1-style reference (e.g., A1, B2). If FALSE, the ref_text is treated as an R1C1-style reference (e.g., R1C1, R2C2).

🔹 Explain the Arguments in the Function:

  • The ref_text argument is the critical part of the INDIRECT Function. It can be a text string that contains a cell reference (e.g., “A1”) or a cell reference itself (e.g., B2). The Function takes this text or reference and returns the value of the cell referred to.

  • The [a1] argument is optional. If you set it to TRUE or omit it, the Function treats it ref_text as an A1-style reference. If you put it to FALSE, it treats ref_text it as an R1C1-style reference. A1-style authorities use letters to indicate columns and numbers to indicate rows (e.g., A1, B2). In contrast, R1C1-style connections use “R” to indicate the row number and “C” to indicate the column number relative to the reference cell (e.g., R1C1, R2C2).

🔹 Return Value: The INDIRECT Function returns the value of the cell specified by the ref_text. If the reference is invalid or doesn’t exist, it will result in a #REF! Error.

🔹 Remarks: The INDIRECT Function is volatile, which means it recalculates every time any change occurs in the worksheet. Using it excessively or in large datasets can slow down Excel’s performance.

✨ Part 2. Examples of the INDIRECT Function in Microsoft Excel:
🔹 Example 1: Consider a simple sales data table for three products in different quarters.

ABC
1ProductQ1Q2
2Product A100150
3Product B200180
4Product C300250

Now, we want to calculate the total sales for each product.

Step 1: Create a new table to display the total sales:

AB
1ProductTotal Sales
2Product A
3Product B
4Product C

Step 2: In cell B2 of the second table, enter the following formula:

Excel
=SUM(INDIRECT("'Sheet1'!"&ADDRESS(2,MATCH(B$1,'Sheet1'!$1:$1,0))), INDIRECT("'Sheet1'!"&ADDRESS(3,MATCH(B$1,'Sheet1'!$1:$1,0))), INDIRECT("'Sheet1'!"&ADDRESS(4,MATCH(B$1,'Sheet1'!$1:$1,0))))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function to create dynamic references to the quarterly sales data for each product. The ADDRESS function is used to find the column number of the quarter specified in the second table’s header row (B$1). The MATCH function finds the corresponding column header in the first table (‘Sheet1’!$1:$1), and the ADDRESS function returns the cell reference. The INDIRECT Function resolves these references and sums the sales values for each product.

🔹 Example 2: Let’s consider a similar sales data table, but this time, we want to find the highest sales value for each product in different quarters.

ABC
1ProductQ1Q2
2Product A100150
3Product B200180
4Product C300250

Step 1: Create a new table to display the highest sales:

AB
1ProductHighest Sales
2Product A
3Product B
4Product C

Step 2: In cell B2 of the second table, enter the following formula:

Excel
=MAX(INDIRECT("'Sheet1'!"&ADDRESS(2,MATCH(B$1,'Sheet1'!$1:$1,0))), INDIRECT("'Sheet1'!"&ADDRESS(3,MATCH(B$1,'Sheet1'!$1:$1,0))), INDIRECT("'Sheet1'!"&ADDRESS(4,MATCH(B$1,'Sheet1'!$1:$1,0))))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function, similar to Example 1, to create dynamic references to the quarterly sales data for each product. Then, the MAX function is used to find the highest sales value for each product.

🔹 Example 3: Consider a more complex example involving multiple sheets with sales data for different regions.

Sheet1 (North Region):

ABC
1ProductQ1Q2
2Product A100150
3Product B200180
4Product C300250

Sheet2 (South Region):

ABC
1ProductQ1Q2
2Product A120100
3Product B180160
4Product C220190

Sheet3 (West Region):

ABC
1ProductQ1Q2
2Product A8090
3Product B150130
4Product C190220

Step 1: Create a new table to display the highest sales for each product and region:

ABCD
1ProductNorthSouthWest
2Product A
3Product B
4Product C

Step 2: In cell B2 of the second table, enter the following formula for the North region:

Excel
=MAX(INDIRECT("'North'!"&ADDRESS(2,MATCH(B$1,'North'!$1:$1,0))), INDIRECT("'North'!"&ADDRESS(3,MATCH(B$1,'North'!$1:$1,0))))

Step 3: In cell C2, enter the following formula for the South region:

Excel
=MAX(INDIRECT("'South'!"&ADDRESS(2,MATCH(B$1,'South'!$1:$1,0))), INDIRECT("'South'!"&ADDRESS(3,MATCH(B$1,'South'!$1:$1,0))))

Step 4: In cell D2, enter the following formula for the West region:

Excel
=MAX(INDIRECT("'West'!"&ADDRESS(2,MATCH(B$1,'West'!$1:$1,0))), INDIRECT("'West'!"&ADDRESS(3,MATCH(B$1,'West'!$1:$1,0))))

Step 5: Drag the formulas to fill the remaining cells in each column.

Explanation: The procedures use the INDIRECT Function to create dynamic references to the quarterly sales data for each product and region. For example, in cell B2, the formula =MAX(INDIRECT("'North'!"&ADDRESS(2,MATCH(B$1,'North'!$1:$1,0))), INDIRECT("'North'!"&ADDRESS(3,MATCH(B$1,'North'!$1:$1,0)))) references cells B2 and C2 in the North sheet and returns the highest sales value for Product A in the North region. Similarly, formulas in other columns calculate the highest sales for each product in their respective regions.

🔹 Example 4: Suppose we have sales data for different products and regions in separate sheets, and we want to calculate the total sales for a specific region.

Sheet1 (North Region):

AB
1ProductSales
2Product A100
3Product B150

Sheet2 (South Region):

AB
1ProductSales
2Product A120
3Product B90

Sheet3 (West Region):

AB
1ProductSales
2Product A80
3Product B110

Step 1: Create a new table to display the total sales for a specific region:

AB
1RegionTotal Sales
2North
3South
4West

Step 2: In cell B2 of the second table, enter the following formula to calculate the total sales for the North region:

Excel
=SUM(INDIRECT("'North'!B2:B3"))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function to create a dynamic reference to the range of sales data for the North region. The SUM function then calculates the total sales for the specified range.

🔹 Example 5: In this example, we want to find the maximum sales value for a given product across all regions.

Sheet1 (North Region):

AB
1ProductSales
2Product A100
3Product B150

Sheet2 (South Region):

AB
1ProductSales
2Product A120
3Product B90

Sheet3 (West Region):

AB
1ProductSales
2Product A80
3Product B110

Step 1: Create a new table to display the maximum sales for each product:

AB
1ProductMax Sales
2Product A
3Product B

Step 2: In cell B2 of the second table, enter the following formula to find the maximum sales value for Product A:

Excel
=MAX(INDIRECT("'North'!B2"), INDIRECT("'South'!B2"), INDIRECT("'West'!B2"))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function nested within the MAX function to create dynamic references to the sales data for each product in different regions. It then returns the maximum sales value for each product.

🔹 Example 6: Let’s consider a table of expenses for different categories in separate sheets, and we want to calculate the total costs for each type.

Sheet1 (Utilities):

AB
1CategoryExpense
2Electricity100
3Water50

Sheet2 (Office Supplies):

AB
1CategoryExpense
2Pens20
3Paper30

Sheet3 (Travel):

AB
1CategoryExpense
2Flight200
3Hotel300

Step 1: Create a new table to display the total expenses for each category:

AB
1CategoryTotal Expense
2Utilities
3Office Supplies
4Travel

Step 2: In cell B2 of the second table, enter the following formula to calculate the total expenses for the utility category:

Excel
=SUM(INDIRECT("'Utilities'!B2"), INDIRECT("'Utilities'!B3"))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function to create dynamic references to the expense data for each category in the different sheets. The SUM function then calculates the total expenses for each type.

🔹 Example 7: In this example, we want to look up the sales data for a specific product and quarter from a table in a separate sheet.

Sheet1 (Sales Data):

ABC
1ProductQ1Q2
2Product A100150
3Product B200180
4Product C300250

Sheet2 (Lookup Table):

AB
1ProductQuarter
2Product BQ1
3Product CQ2

Step 1: Create a new table to display the sales data for the specific products and quarters:

ABC
1ProductQuarterSales
2Product BQ1
3Product CQ2

Step 2: In cell C2 of the second table, enter the following formula to look up the sales data for Product B in Q1:

Excel
=VLOOKUP(A2&" "&B2, INDIRECT("'Sales Data'!A$2:C$4"), 3, 0)

Step 3: Drag the formula to fill the remaining cells in column C.

Explanation: The formula uses the INDIRECT Function nested within the VLOOKUP function to create dynamic references to the sales data table in the “Sales Data” sheet. It looks up the sales value based on the specified product and quarter combination in the “Lookup Table” sheet.

🔹 Example 8: Suppose we have sales data for different products in separate sheets and want to find the average sales for a specific product across all regions.

Sheet1 (North Region):

AB
1ProductSales
2Product A100
3Product B150

Sheet2 (South Region):

AB
1ProductSales
2Product A120
3Product B90

Sheet3 (West Region):

AB
1ProductSales
2Product A80
3Product B110

Step 1: Create a new table to display the average sales for each product:

AB
1ProductAvg Sales
2Product A
3Product B

Step 2: In cell B2 of the second table, enter the following formula to find the average sales value for Product A:

Excel
=AVERAGE(INDIRECT("'North'!B2"), INDIRECT("'South'!B2"), INDIRECT("'West'!B2"))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function nested within the AVERAGE Function to create dynamic references to the sales data for each product in different regions. It then returns the average sales value for each product.

🔹 Example 9: Let’s consider a table of expenses for different categories in separate sheets, and we want to find the class with the highest costs.

Sheet1 (Utilities):

AB
1CategoryExpense
2Electricity100
3Water50

Sheet2 (Office Supplies):

AB
1CategoryExpense
2Pens20
3Paper30

Sheet3 (Travel):

AB
1CategoryExpense
2Flight200
3Hotel300

Step 1: Create a new table to display the category with the highest expenses:

AB
1CategoryMax Expense
2

Step 2: In cell B2 of the second table, enter the following formula to find the category with the highest expenses:

Excel
=INDEX(INDIRECT("'Utilities'!A2:A3"), MATCH(MAX(INDIRECT("'Utilities'!B2:B3")), INDIRECT("'Utilities'!B2:B3"), 0))

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function nested within the INDEX and MATCH functions to find the category with the highest expenses in the “Utilities” sheet. It considers first the maximum expense value using the MAX function with the INDIRECT Function to create dynamic references to the expense data. Then, the MATCH function finds the position of the maximum value in the expense range, and the INDEX function retrieves the corresponding category name.

🔹 Example 10: Suppose we have data for different products and their corresponding prices in separate sheets, and we want to calculate the total revenue for each product.

Sheet1 (Products):

AB
1ProductPrice
2Product A10
3Product B15

Sheet2 (Sales):

AB
1ProductQuantity
2Product A50
3Product B30

Step 1: Create a new table to display the total revenue for each product:

AB
1ProductTotal Revenue
2Product A
3Product B

Step 2: In cell B2 of the second table, enter the following formula to calculate the total revenue for Product A:

Excel
=INDIRECT("'Products'!B2") * INDIRECT("'Sales'!B2")

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function to create dynamic references to the product prices and quantities in different sheets. It then calculates the total revenue for each product by multiplying the price by the amount sold.

🔹 Example 11: Let’s consider a table with different currencies and their corresponding exchange rates in separate sheets, and we want to convert an amount from one currency to another.

Sheet1 (USD):

AB
1CurrencyRate
2EUR0.85
3GBP0.74

Sheet2 (EUR):

AB
1CurrencyAmount
2USD500
3GBP400

Step 1: Create a new table to display the converted amounts:

ABC
1FromToConverted Amount
2USDEUR
3USDGBP

Step 2: In the cell, C2 of the second table, enter the following formula to convert the amount from USD to EUR:

Excel
=INDIRECT("'Sheet1'!"&ADDRESS(MATCH(A2, 'Sheet1'!$A:$A, 0), 2)) * INDIRECT("'Sheet2'!"&ADDRESS(2, MATCH(B2, 'Sheet2'!$1:$1, 0)))

Step 3: Drag the formula to fill the remaining cells in column C.

Explanation: To convert currency, the formula uses the INDIRECT Function nested within the ADDRESS, MATCH, and multiplication functions. It creates dynamic references to the exchange rates and the amount to be converted, then performs the conversion calculation.

🔹 Example 12: In this example, we have data for different expenses in separate sheets, and we want to check if the total costs exceed a specific budget for each category.

Sheet1 (Utilities):

AB
1CategoryExpense
2Electricity100
3Water50

Sheet2 (Office Supplies):

AB
1CategoryExpense
2Pens20
3Paper30

Sheet3 (Travel):

AB
1CategoryExpense
2Flight200
3Hotel300

Step 1: Create a new table to display whether the expenses exceed the budget for each category:

AB
1CategoryExceed Budget
2Utilities
3Office Supplies
4Travel

Step 2: In cell B2 of the second table, enter the following formula to check if the expenses for Utilities exceed the budget of $120:

Excel
=IF(SUM(INDIRECT("'Utilities'!B2:B3")) > 120, "Yes", "No")

Step 3: Drag the formula to fill the remaining cells in column B.

Explanation: The formula uses the INDIRECT Function to create dynamic references to the expense data for each category in different sheets. The SUM function then calculates the total expenses for each type, and the IF function checks if the costs exceed the specified budget, returning “Yes” if true and “No” if false.

These examples demonstrate the flexibility and power of the INDIRECT Function when combined with various other functions. It allows you to build dynamic and automated Excel solutions for various scenarios involving data from multiple sheets and different computations.

✨ Part 3. Tips and Tricks:

  • Use Cell References Wisely: When working with the INDIRECT Function, it’s essential to ensure that the referenced cells are consistent and correctly updated. Avoid deleting rows or columns that are being referred to, as it can cause #REF! Errors.

  • Avoid Overusing INDIRECT: Since the INDIRECT Function is volatile and can slow down Excel’s performance, use it sparingly, especially in large datasets or complex formulas.

  • Handle Errors: Be cautious when using INDIRECT with cell references that may not exist, as it can lead to errors. You can use the IFERROR function to handle potential errors gracefully.

  • Dynamic Named Ranges: Combine the INDIRECT Function with named ranges to create dynamic and easy-to-read formulas. Named ranges can be more descriptive and easier to maintain than direct cell references.

  • Check Calculation Options: If you encounter unexpected results with INDIRECT, check Excel’s calculation options. If “Automatic” is disabled, it may prevent the Function from updating correctly.

By following these tips and using the INDIRECT Function effectively, you can create powerful and dynamic Excel spreadsheets to meet various data analysis needs, especially when dealing with data across different sheets and regions.

Leave a Comment