How to Create Dynamic Cell References in Excel?
Changing a cell value can dynamically alter your references to different sheets or ranges, streamlining your data management.
Formula Genius can generate a draft from a plain-English prompt. Supported formulas can be checked with sample cases; review the coverage on the result.
The formula
"Build a cell reference from text, so that changing a cell value changes which sheet or range is referenced"
=INDIRECT(A1 & "!B1")
This formula constructs a cell reference based on text in another cell, allowing for dynamic referencing.
Step-by-step breakdown
- Step 1: Identify the cell (e.g., A1) that contains the sheet name or range.
- Step 2: Use the ampersand (&) to concatenate the sheet name with the cell reference (e.g., "!B1").
- Step 3: Pass the concatenated string to the INDIRECT function.
- Step 4: INDIRECT evaluates the string and returns the value from the specified sheet or range.
Edge cases & warnings
- If the referenced sheet name contains spaces, it must be enclosed in single quotes.
- If the cell reference is invalid, INDIRECT will return a #REF! error.
- Changing the sheet name in the reference cell to a non-existent sheet will also cause a #REF! error.
Examples
"If A1 contains 'Sheet2', the formula =INDIRECT(A1 & "!B1") returns the value in B1 of Sheet2."
Value from Sheet2!B1
"If A1 contains 'Sales' and B1 contains 'Total', the formula =INDIRECT(A1 & "!B1") returns the value in B1 of Sales."
Value from Sales!B1
Frequently asked questions
Can INDIRECT reference cells in closed workbooks?
No, INDIRECT only works with open workbooks.
What happens if the referenced sheet is deleted?
You will receive a #REF! error if the sheet is deleted.
Is INDIRECT volatile?
Yes, INDIRECT is a volatile function and recalculates whenever any change is made in the workbook.
Can't find what you need?
Describe a formula in plain English. Formula Genius drafts and explains it, and can check supported formulas on sample cases.