How to Show a Formula as Text with FORMULATEXT in Excel
Display the formula behind any cell, flag hard-coded numbers in an audit, and show the formula behind a looked-up row.
You will learn to
- Show a cell’s formula next to its result
- Test a formula’s text to catch hard-coded values
- Return the formula behind a looked-up cell
How it works
FORMULATEXT(reference) returns the formula in a cell as text, so =FORMULATEXT(D2) displays "=B2*(1+C2)" beside the price it calculates. It is ideal for documenting a model or teaching how a sheet works. If the cell holds a typed value instead of a formula, FORMULATEXT returns #N/A.
Because the result is ordinary text, you can test it. =IF(ISNUMBER(SEARCH("C",FORMULATEXT(D4))),"Uses markup","Hard-coded") flags price formulas that ignore the markup column — a quick audit for numbers typed straight into formulas.
=FORMULATEXT(D2)