FORMULATEXT function
Shows the formula in a cell as text, so you can display or document how a result was calculated.
Available in Excel 2013 and later, Microsoft 365, Excel for the web, Excel for Mac 2016+
Excel 2013 and laterWorks in Google Sheets
Syntax
FORMULATEXT(reference)| Argument | What it means | |
|---|---|---|
reference | Required | A cell (or range - only its top-left cell is used) that contains a formula. It can be on another sheet or in another open workbook. |
Returns: The formula as text, starting with =, exactly as it appears in the formula bar.
How FORMULATEXT works
FORMULATEXT reveals the formula behind a cell without switching the whole sheet to formula view. Point it at a cell and it returns the formula as text - perfect for training material, audit sheets, or a column next to your calculations that shows readers how each number was produced.
The result is a snapshot of the formula bar: references appear exactly as typed and update if you insert rows, because Excel updates the original formula. If the target cell holds a typed value rather than a formula, FORMULATEXT returns #N/A, which makes it a quick test in combination with ISFORMULA or IFNA. It returns the text but never evaluates it.
Examples
1Show the formula behind a total
| A | B | C | |
|---|---|---|---|
| 1 | Month | Sales | |
| 2 | Jan | 8200 | |
| 3 | Feb | 9150 | |
| 4 | Mar | 10400 | |
| 5 | Total | 27750 | =SUM(B2:B4) |
Result: =SUM(B2:B4)
B5 contains =SUM(B2:B4) and displays 27750. FORMULATEXT returns the formula itself as text.
2A typed value has no formula
| A | B | C | |
|---|---|---|---|
| 1 | Month | Sales | |
| 2 | Jan | 8200 | typed value |
| 3 | Feb | 9150 | |
| 4 | Mar | 10400 | |
| 5 | Total | 27750 |
Result: typed value
B2 is a typed number, so FORMULATEXT returns #N/A; IFNA replaces it with a label. This flags hard-coded numbers in a model.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#N/A | The referenced cell has no formula, or it is in a closed workbook or a protected sheet whose formulas are hidden. | Point to a formula cell, open the source workbook, or unprotect the sheet. |
Tips
- Ctrl+` (grave accent) toggles formula view for the whole sheet; FORMULATEXT is better when you want values and formulas side by side.
- To document a whole column of calculations, put
=FORMULATEXT(B2)next to the first one and copy it down.
Google Sheets
FORMULATEXT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
FORMULATEXT in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | FORMELTEKST |
| Dutch | FORMULETEKST |
| Finnish | KAAVA.TEKSTI |
| French | FORMULETEXTE |
| German | FORMELTEXT |
| Hungarian | KÉPLETSZÖVEG |
| Italian | TESTO.FORMULA |
| Norwegian (Bokmål) | FORMELTEKST |
| Polish | FORMUŁA.TEKST |
| Portuguese (Brazil) | FÓRMULATEXTO |
| Portuguese (Portugal) | FÓRMULA.TEXTO |
| Russian | Ф.ТЕКСТ |
| Spanish | FORMULATEXTO |
| Swedish | FORMELTEXT |
| Turkish | FORMÜLMETNİ |