INDIRECT

Short answer

Pull from a tab named in a cell, at an audit cost

INDIRECT(ref_text, [a1])
Excel version
All versions
Also searched as
reference from text, sheet name in a cell, dynamic sheet reference, lookup across tabs, volatile function, indirect excel

What it returns

INDIRECT takes a piece of text that spells out a cell reference and returns the reference itself. If A2 holds the text North!D20, then =INDIRECT(A2) returns whatever is in cell D20 on the tab named North.

That lets a formula point at a tab or a cell chosen by the contents of another cell. It is how people build a summary page where typing an entity name pulls that entity’s numbers.

The flexibility has three costs, and in a model that other people review they usually outweigh it:

  • It is invisible to auditing tools. Trace Precedents cannot follow a reference built from text, so the summary appears to depend on nothing.
  • It is volatile. INDIRECT recalculates on every change anywhere in the workbook, along with everything downstream of it.
  • Its references do not move. Insert a row on the source tab and a normal reference adjusts. The text “D20” stays D20 and now points at the wrong line.

Arguments that matter

ArgumentRequiredWhat it does
ref_textYesText that spells a reference: "D20", "North!D20", "'North America'!D20:O20", or a defined name.
a1NoTRUE or omitted reads the text as A1 style. FALSE reads it as R1C1, as in "R20C4".

Rules that cause most of the errors:

  • A tab name with a space or punctuation needs single quotes around it in the text: "'"&B5&"'!D20". Build the quotes in every time, since a tab without spaces still accepts them.
  • If ref_text refers to another workbook, that workbook must be open. Closed, INDIRECT returns #REF!.
  • Text that is not a valid reference returns #REF!. A misspelled tab name is the usual cause.

In a financial model

INDIRECT has one job it does well: reading the same cell from several tabs that are built identically, where the list of tabs is data. A consolidation of twelve entity tabs, each laid out the same way per anchor rows match across tabs, with the entity names in a column on the summary.

Everywhere else there is a better tool:

  • A scenario or case selector. CHOOSE or INDEX on a scenario table keeps every input on the dependency tree.
  • A consolidation. Stack the entity data into one long table with VSTACK or Power Query, then use SUMIFS on the entity column. The tabs stop being structure and become data.
  • Selecting a column by period. XLOOKUP or INDEX with XMATCH on the header row, never a column letter built from text.

The play avoid volatile functions makes the general case. INDIRECT is the hardest volatile function to justify, because it also defeats the review step in walk the model backwards once.

Worked example

A summary tab lists entity names in B5:B16. Each entity has its own tab named exactly as listed, with full-year revenue in cell P20.

=INDIRECT("'"&$B5&"'!P20")

Fill down and each row reads its entity’s tab. It works. Now look at what it does to the model:

  • Select the summary cell and run Trace Precedents. No arrows. The reviewer cannot see where the number came from without reading the formula and finding the tab by hand.
  • Insert a row above row 20 on the North tab. Revenue moves to P21. The summary still reads P20, which is now a different line.
  • Rename the tab from “North” to “North America”. The summary returns #REF! until someone retypes B5.

The auditable alternative when the entity tabs are fixed is CHOOSE, with the entity number in A5:

=CHOOSE($A5, North!$P$20, South!$P$20, East!$P$20, West!$P$20)

Every reference is real. Trace Precedents shows all four tabs, row inserts adjust the references, and renaming a tab updates the formula.

The better alternative is to stop storing entities as tabs. Load each entity’s data into one Table, Data, with an Entity column, and the summary becomes:

=SUMIFS(Data[Amount], Data[Entity], $B5, Data[Line], "Revenue")

Adding a thirteenth entity is new rows, not a new tab and a new formula.

Old way vs new way

The old way to stack identical tabs in a formula was INDIRECT over a list of tab names. In Excel 365, VSTACK accepts a 3D reference directly and stacks every tab between two others:

=VSTACK(North:West!A2:F500)

That is a real reference, so it is traceable and not volatile. FILTER can drop the blank rows afterwards.

Where it breaks

#REF! after a tab rename. The text in the summary no longer matches any tab name. Fix: if INDIRECT stays, add a check that counts #REF! results in the summary to the check row, so a rename is caught the moment it happens.

#REF! when the source workbook is closed. INDIRECT only reads open workbooks. A model that pulls from a monthly file via INDIRECT works while the builder has both files open and fails as soon as the source is closed. Fix: bring the external data in with Power Query instead.

The numbers are from the wrong line. Rows were inserted on a source tab and the text reference did not move. There is no error. Fix: point INDIRECT at a defined name that moves with the row, such as INDIRECT("'"&$B5&"'!Revenue_FY") with a sheet-scoped name on each tab, or switch to one of the alternatives above.

The workbook is slow. INDIRECT is volatile, so every edit recalculates it and every formula that depends on it. A few hundred INDIRECT cells feeding a large model can make every keystroke lag. Fix: replace them, or at minimum confine them to one small summary.

The tab name has a space and the formula fails. The quotes were left out. Fix: always concatenate "'" before and "'!" after the tab name.

Related functions

  • CHOOSE. The traceable alternative when the set of tabs or cases is fixed.
  • VSTACK. Stacks identical tabs through a 3D reference without text.
  • SUMIFS. Reads a consolidated long table by entity, replacing per-tab references entirely.
  • XLOOKUP. Selects a row or column by a label, which is what most INDIRECT column tricks are trying to do.
  • FILTER. Pulls one entity’s rows out of a stacked table.
  • The play avoid volatile functions is the rule INDIRECT breaks by design.

All functions