The INDIRECT function returns the reference specified by a text string. This allows you to build cell references dynamically using text, making it powerful for creating flexible formulas that reference cells based on calculations or variable inputs. INDIRECT is essential for advanced Excel modeling and dynamic references.
=INDIRECT(ref_text, a1)A text string that represents a cell reference (e.g., "A1", "Sheet2!B5", "R1C1"). Can be a cell containing a reference string or a formula that creates a reference string.
A logical value: TRUE or omitted = A1-style reference, FALSE = R1C1-style reference. Default is TRUE (A1-style).
Reference to the cell specified by the text string, or the value in that cell
Description: Returns the reference specified by a text string, enabling dynamic cell references
Create reference from text string
Returns reference to A1 and gets its value. Simple example of text-to-reference conversion.
Master the fundamentals of Excel INDIRECT function
The INDIRECT function is Excel's text-to-reference converter that dynamically creates cell references from text strings. This enables powerful dynamic formulas but comes with performance considerations as INDIRECT is a volatile function that recalculates on every Excel recalculation.
Converts text strings to cell references
Recalculates on every Excel recalculation
Enables formulas that build references dynamically
Supports A1 and R1C1 styles
Function-specific parameters
Function-specific return type
Create ranges based on calculations
Reference other sheets dynamically
Create dynamic data validation lists
Build formulas from text patterns
Exact matching required
Returns numeric position
Handles missing text gracefully
=INDIRECT(ref_text, a1)Text string representing cell reference
TRUE=A1 style (default), FALSE=R1C1 style
Reference or value from specified cell
Description: Converts text string to cell reference
Text to reference
Converts text to reference
Using INDIRECT in VBA
Sub INDIRECTExample()
' Method 1: Using WorksheetFunction.Indirect
Dim result As Variant
result = Application.WorksheetFunction.Indirect("A1")
Range("B1").Value = result
' Method 2: Dynamic reference from cell
Dim refText As String
refText = Range("A1").Value
result = Application.WorksheetFunction.Indirect(refText)
Range("B2").Value = result
' Method 3: Build reference dynamically
Dim rowNum As Integer
Dim colNum As Integer
rowNum = 5
colNum = 2
Dim dynamicRef As String
dynamicRef = "R" & rowNum & "C" & colNum
result = Application.WorksheetFunction.Indirect(dynamicRef, False)
Range("B3").Value = result
' Method 4: Cross-sheet reference
Dim sheetName As String
Dim cellRef As String
sheetName = "Sheet2"
cellRef = sheetName & "!B5"
result = Application.WorksheetFunction.Indirect(cellRef)
Range("B4").Value = result
' Method 5: Dynamic range
Dim startRow As Integer
Dim endRow As Integer
startRow = 1
endRow = 10
Dim rangeRef As String
rangeRef = "A" & startRow & ":A" & endRow
Dim sumResult As Variant
sumResult = Application.WorksheetFunction.Sum( _
Application.WorksheetFunction.Indirect(rangeRef))
Range("B5").Value = sumResult
' Method 6: Using Range object directly (alternative to INDIRECT)
Dim ws As Worksheet
Set ws = ActiveSheet
Dim cellRange As Range
Set cellRange = ws.Range("A1")
Range("B6").Value = cellRange.Value
' Method 7: Named range from text
Dim namedRangeName As String
namedRangeName = "Fruits"
result = Application.WorksheetFunction.Indirect(namedRangeName)
Range("B7").Value = result
End SubBuild ranges from calculations
Reference other sheets dynamically
Create dynamic data validation
Reference cells based on variables
Invalid cell reference text
=INDIRECT("Sheet Name!A1")Solution: Verify the ref_text is a valid cell reference. Check for typos, invalid sheet names, or references to closed workbooks. For sheet names with spaces, use quotes: "Sheet Name!A1".
Workbook recalculates slowly
Use alternatives when possibleSolution: INDIRECT is volatile and recalculates frequently. Minimize use, especially in large workbooks. Consider alternatives like INDEX, OFFSET (also volatile), or restructuring formulas to avoid INDIRECT when possible.
Cannot reference closed workbook
Open referenced workbookSolution: INDIRECT cannot reference cells in closed workbooks. The workbook must be open for INDIRECT to work. Use alternative methods like external references or keep workbooks open.
Creates circular reference error
Avoid circular references in ref_textSolution: Ensure INDIRECT doesn't reference its own cell or create a circular dependency. Check that ref_text doesn't create a reference chain that loops back.