Example 1
Show the formula beside its result
C2 =FORMULATEXT(B2)
Result: =A2*1.2
FORMULATEXT returns the formula in B2 as text, including the equals sign. B2 keeps calculating as normal.
C2 =FORMULATEXT(B2) returns =A2*1.2
Returns the formula in a cell as text, exactly as it appears in the formula bar. Use it to document a model or to show a formula beside its result.
Syntax
=FORMULATEXT()
Excel 2013 and later, including Microsoft 365, Excel 2024, 2021, 2019 and 2016, Excel for the web and the mobile apps. Not available in Excel 2010 or earlier.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =FORMULATEXT(B2) returns =A2*1.2
FORMULATEXT shows the formula in a cell as text. If B2 contains =A2*1.2, then =FORMULATEXT(B2) in another cell returns the text =A2*1.2. It is the tidy way to show a formula next to its result in a worked example, a handover note, a model-review sheet or a training document.
reference is the cell to read. Use a single cell. The result is the formula as Excel would show it in the formula bar, starting with the equals sign.
#N/A.#N/A.#N/A.Before FORMULATEXT, people showed formulas by putting an apostrophe in front, which turned the formula into text and stopped it calculating. FORMULATEXT is better: the real formula keeps calculating in its own cell, and the text display is a separate, live cell. If the formula changes, the text changes with it.
Because a plain value returns #N/A, wrap the call when you point it at a mixed range: =IFERROR(FORMULATEXT(B2), "No formula"). IFERROR hides every error, and FORMULATEXT can only return #N/A in this situation, so IFNA is the narrower choice. In Excel 2013 and later, you can also test with ISFORMULA(B2) first.
FORMULATEXT returns the formula as written, with the references as they currently stand. Copying the FORMULATEXT cell down a column doesn't copy the formula it reads, because the text is just text: the reference inside FORMULATEXT is what shifts, so FORMULATEXT(B2) becomes FORMULATEXT(B3). If you need to run the formula text as a calculation, you can't: INDIRECT turns text into a reference, not into a calculation, so the text is for display only.
A formula longer than 8,192 characters returns #N/A.
B2. If you give a range, FORMULATEXT uses its top-left cell. If the cell has no formula, the result is #N/A.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =FORMULATEXT(B2)
Result: =A2*1.2
FORMULATEXT returns the formula in B2 as text, including the equals sign. B2 keeps calculating as normal.
C2 =FORMULATEXT(B2) returns =A2*1.2
Example 2
D2 =FORMULATEXT(B5)
Result: =SUM(B2:B4)
The result is the formula text, not the total. The total, 1,257, stays in B5.
D2 =FORMULATEXT(B5) returns =SUM(B2:B4)
Example 3
C2 =FORMULATEXT(B2)
Result: #N/A
B2 holds the typed number 60, not a formula, so FORMULATEXT has nothing to return.
C2 =FORMULATEXT(B2) returns #N/A
Example 4
C2 =IFNA(FORMULATEXT(B2),"No formula")
Result: No formula
IFNA catches the #N/A and shows your text. It is a better choice here than IFERROR, because it leaves any other error visible.
C2 =IFNA(FORMULATEXT(B2),"No formula") returns No formula
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In C2, show the formula in B2 as text. Fill down to C4.
Answer in C2, then it fills down to C4.
#N/A, not an empty result. Wrap the call in IFNA when the range mixes typed values and formulas.#N/A. That is by design.#NAME?.Use FORMULATEXT: `=FORMULATEXT(B2)` returns the formula in B2 as text. Don't use an apostrophe in front of the formula, because that stops it calculating.
The referenced cell has no formula, the formula is hidden by sheet protection, or the cell is in a closed workbook. A plain number, text or empty cell always returns #N/A.
Press Ctrl+` (the grave accent key) to show formulas instead of results, or use Show Formulas on the Formulas tab. Use FORMULATEXT when you want the formulas in cells of their own.
It was added in Excel 2013. In Excel 2010 and earlier it returns #NAME?.
Tracks take you from the basics to modelling, one graded exercise at a time.