FORMULATEXT: Display Formulas as Text – Debug & Audit Like a Pro

FORMULATEXT FUNCTION IN EXCEL Feature Image
Learn how to use FORMULATEXT in Excel to display any formula as readable text. Covers audit sheets, IFERROR handling, LEN complexity checks, and searching for specific functions.

Clicking into every cell one by one to check what formula it contains is slow and error-prone. It also provides no permanent record. The FORMULATEXT function fixes this — it reads the formula from any cell and displays it as a text string, right there in the worksheet. You can see it, copy it, search it, and compare it alongside the result. Consequently, it transforms how you audit, document, and hand over complex workbooks.

The returned text is identical to what appears in the formula bar. Additionally, it updates automatically whenever the source formula changes. This makes FORMULATEXT the foundation of any living documentation system for Excel.

Availability: FORMULATEXT is available in Excel 2013 and all later versions, including Microsoft 365, Excel 2024, 2021, 2019, and 2016. It is not available in Excel 2010 or earlier.

What Is the FORMULATEXT Syntax?

FORMULATEXT takes a single argument — the cell you want to inspect.

=FORMULATEXT(reference)
ArgumentRequired?What it does
referenceRequiredThe cell whose formula you want to display as text. Must be a single cell or a named range. If you pass a multi-cell range, FORMULATEXT returns the formula from the upper-left cell only (in Excel 2013–2021). In Excel 365, passing a range spills the formula from every cell in that range.
FORMULATEXT returns #N/A for value-only cells: If the referenced cell contains a plain number, text, or is empty — rather than a formula — FORMULATEXT returns #N/A. Wrap in IFERROR or combine with ISFORMULA to handle this gracefully. Example 2 shows both approaches.

What Does FORMULATEXT Return?

The function returns the formula exactly as it was entered — equal sign, function name, arguments, and all. The result is a plain text string. Consequently, all standard text functions work on its output. Use LEN to measure its length, SEARCH to find specific function names, or EXACT to compare two formulas character by character.

Importantly, FORMULATEXT does not trigger a circular reference warning if you reference the same cell it lives in. For instance, typing =FORMULATEXT(A1) in cell A1 returns the formula as text. Excel does not report a circular reference error. This is an exception to the usual circular reference rule.

Example 1: Display a Formula as Text Alongside Its Result

The most immediate use is placing a FORMULATEXT column next to a formula column. You see the value in one cell and the logic that produced it immediately to its right. This approach turns any spreadsheet into a self-documenting reference — no switching to formula view, no clicking around.

1
Show formula text next to each calculated result in column B
A — Input
B — Result
C — Formula (FORMULATEXT)
D — Entry in C
85
Pass
=IF(A2>=70,"Pass","Fail")
=FORMULATEXT(B2)
42
Fail
=IF(A3>=70,"Pass","Fail")
=FORMULATEXT(B3)
100
Pass
=IF(A4>=70,"Pass","Fail")
=FORMULATEXT(B4)
Place in column C, then copy down to cover all rows with formulas. Each cell in column C shows the formula text from the cell to its left. =FORMULATEXT(B2) → =IF(A2>=70,"Pass","Fail") Reference a cell on another sheet — cross-sheet inspection: =FORMULATEXT(Reports!D5) → shows the formula from cell D5 on the Reports sheet Excel 365 — pass a range to spill formula text for every cell at once: One formula in C2 returns results for all 10 rows below B2:B11. =FORMULATEXT(B2:B11)
In Excel 365, passing a range like B2:B11 spills the formula text for every cell automatically. In Excel 2013–2021, only the upper-left cell's formula is returned — copy the formula down manually for each row instead.

Example 2: Handle #N/A with IFERROR and ISFORMULA

A column you audit will often contain formulas, plain values, and blanks. FORMULATEXT returns #N/A for anything that is not a formula. However, mixing formula text and #N/A errors in the same column looks unprofessional in a report. Two approaches handle this cleanly — IFERROR for speed, and ISFORMULA for precision.

2
Show "No formula" for plain-value cells — clean error handling
B — Cell content
Type
FORMULATEXT(B)
With IFERROR
=SUM(A2:A10)
Formula
=SUM(A2:A10)
=SUM(A2:A10)
1,250
Value
#N/A
No formula
(blank)
Empty
#N/A
No formula
IFERROR approach — fastest, catches all errors: Returns the formula text if found, or a fallback message for any error. =IFERROR(=FORMULATEXT(B2), "No formula") Empty string fallback — returns blank instead of "No formula": Cleaner in a dense report where the formula column should just be quiet. =IFERROR(=FORMULATEXT(B2), "") ISFORMULA approach — more explicit, checks first before extracting: ISFORMULA returns TRUE for formula cells, FALSE for values/blanks. =IF(ISFORMULA(B2), =FORMULATEXT(B2), "Value or blank") Count how many cells in B2:B100 contain formulas (not values): ISFORMULA returns TRUE/FALSE; SUMPRODUCT counts the TRUEs. =SUMPRODUCT(--ISFORMULA(B2:B100))
ISFORMULA is the companion to FORMULATEXT: Use ISFORMULA when you need a TRUE/FALSE audit column alongside your formula-text column. Together, they give you both the presence check and the content in one row — ideal for formula inventory sheets.

Example 3: Measure Formula Complexity with LEN

FORMULATEXT returns plain text — which means all standard text functions work on its output. LEN is particularly useful for measuring formula complexity by character count. Long formulas are often harder to maintain. Flagging cells where the formula exceeds a threshold helps you identify candidates for simplification or refactoring.

3
Count formula characters and flag formulas that exceed 100 characters
B — Formula
C — Length
D — Complex?
E — Formula text (C)
F — Formula text (D)
=SUM(A2:A10)
13
=LEN(FORMULATEXT(B2))
=IF(AND(A2>0,B2...)
147
⚠ Complex
=LEN(FORMULATEXT(B3))
=IF(LEN(...)>100,"⚠ Complex","—")
Count the number of characters in the formula stored in B2: =LEN(=FORMULATEXT(B2)) Flag formulas over 100 characters as complex — review candidates: =IF(LEN(=FORMULATEXT(B2))>100, "⚠ Complex", "—") Wrap in IFERROR for value-only cells — skip #N/A: Value-only cells produce #N/A from FORMULATEXT, so LEN errors out. IFERROR returns 0 for non-formula cells. =IFERROR(LEN(=FORMULATEXT(B2)), 0) Find the most complex formula in a column — which cell has the longest formula? Return the length of the longest formula in B2:B100: =MAX(IFERROR(LEN(=FORMULATEXT(B2:B100)), 0)) ← In Excel 365 this is a single formula. In earlier versions use Ctrl+Shift+Enter.

Example 4: Build a Formula Audit Sheet

A formula audit sheet lists every formula in a workbook alongside its cell address, length, and formula text. This creates a permanent, searchable inventory. Colleagues taking over a file can scan it quickly instead of clicking through every cell. Furthermore, it is easy to share or print without revealing source data.

Setting Up an Audit Column

Place FORMULATEXT in a column adjacent to the data. Combine it with ISFORMULA to flag cells, and LEN to measure complexity. Additionally, add =CELL("address", B2) to capture the cell address. This produces a full row-by-row audit trail.

4
Build a four-column formula inventory — address, formula, length, and complexity flag
Audit sheet columns (A through D), referencing source data in Sheet1 column B. Enter the row 2 formulas, then copy down to cover all rows. Column A — Cell address (where the formula lives): =CELL("address", Sheet1!B2) → $B$2 Column B — Formula text (what the formula says): IFERROR handles rows where B2 contains a value, not a formula. =IFERROR(=FORMULATEXT(Sheet1!B2), "—") Column C — Formula length (character count): Returns 0 for non-formula cells instead of an error. =IFERROR(LEN(=FORMULATEXT(Sheet1!B2)), 0) Column D — Complexity flag: =IF(IFERROR(LEN(=FORMULATEXT(Sheet1!B2)),0)>80, "Review", "OK") Count how many formulas exist in the audited range: ISFORMULA(Sheet1!B2:B100) returns an array of TRUE/FALSE values. =SUMPRODUCT(--ISFORMULA(Sheet1!B2:B100))
Protect the audit sheet and share it instead of the source workbook. Stakeholders can read every formula in plain text and review the logic. They can raise questions without ever touching the live data.

Example 5: Compare Formulas in Two Columns with EXACT

EXACT compares two text strings and returns TRUE only when they are identical — every character, including case and spaces, must match. Combining EXACT with FORMULATEXT lets you verify whether two columns use identical formulas, or highlight rows where formulas differ unexpectedly.

5
Detect rows where the formula in column B differs from the one in column C
B — Formula
C — Formula
EXACT match?
Flag
=A2*0.1
=A2*0.1
TRUE
=A3*0.1
=A3*0.15
FALSE
⚠ Mismatch
=SUM(A4:A10)
=SUM(A4:A10)
TRUE
Compare the formula text in B2 and C2 exactly: Returns TRUE if identical, FALSE if any character differs. =EXACT(=FORMULATEXT(B2), =FORMULATEXT(C2)) Flag mismatches — useful for finding inconsistent commission rates or tax logic: =IF(EXACT(=FORMULATEXT(B2), =FORMULATEXT(C2)), "—", "⚠ Mismatch") Wrap in IFERROR to handle rows where either column is a value, not a formula: If either cell has no formula, the comparison returns #N/A. IFERROR cleans that up. =IFERROR( IF(EXACT(=FORMULATEXT(B2), =FORMULATEXT(C2)), "—", "⚠ Mismatch"), "No formula") Count mismatches across an entire range (rows 2 to 100): Returns the number of rows where B and C have different formulas. =SUMPRODUCT(--NOT(IFERROR( EXACT(=FORMULATEXT(B2:B100), =FORMULATEXT(C2:C100)), TRUE)))

Example 6: Search for a Specific Function Inside Any Formula

Because FORMULATEXT outputs plain text, SEARCH and ISNUMBER work on it directly. This lets you scan a whole column and identify every cell that uses a particular function. For instance, find every cell calling VLOOKUP so you can upgrade it to XLOOKUP, or flag formulas with hardcoded values.

6
Find all cells using VLOOKUP — and all cells with hardcoded numbers
ISNUMBER(SEARCH(...)) returns TRUE if the text is found inside the formula. SEARCH is case-insensitive, so it matches "VLOOKUP", "vlookup", "VLookup" equally. Flag cells containing VLOOKUP in column B — for upgrade to XLOOKUP: =IF( ISNUMBER(SEARCH("VLOOKUP", =FORMULATEXT(B2))), "Uses VLOOKUP", "—") Count VLOOKUP formulas in the whole column: ISNUMBER(SEARCH(...)) produces TRUE/FALSE; SUMPRODUCT counts TRUEs. =SUMPRODUCT(--ISNUMBER(SEARCH("VLOOKUP", IFERROR(=FORMULATEXT(B2:B100), "")))) Find formulas using IF with a hardcoded number (not a cell reference). Look for patterns like IF(*,number — approximate but useful heuristic. =ISNUMBER(SEARCH("IF(", =FORMULATEXT(B2))) Check whether a formula references a specific cell or named range. For example, find any formula that references the named range "TaxRate": =ISNUMBER(SEARCH("TaxRate", =FORMULATEXT(B2))) List all functions used — extract the function name from each formula. LEFT captures everything before the first "(" in the formula string. =LEFT(=FORMULATEXT(B2), FIND("(", =FORMULATEXT(B2))-1) → "=IF", "=SUM", "=VLOOKUP", etc. (includes the = sign)
Bulk VLOOKUP-to-XLOOKUP audit: Run =SUMPRODUCT(--ISNUMBER(SEARCH("VLOOKUP", IFERROR(FORMULATEXT(B:B),"")))) on any column. The result tells you exactly how many cells still use VLOOKUP. Prioritise sheets with the highest counts for modernisation first.

How to Fix Common FORMULATEXT Errors

#N/A — cell does not contain a formula

FORMULATEXT only works on cells with formulas. A cell containing a number, text string, or blank produces #N/A. The fix is to wrap in IFERROR: =IFERROR(FORMULATEXT(A2), ""). Alternatively, check first with ISFORMULA: =IF(ISFORMULA(A2), FORMULATEXT(A2), "—"). Both approaches produce clean output across mixed columns.

#N/A — referencing a closed external workbook

FORMULATEXT also returns #N/A when the referenced cell is in another workbook that is not currently open. Open the external workbook first, then run the formula. Alternatively, open the workbook first, copy the formula text, and paste it as a static value in your audit sheet.

#N/A — formula is longer than 8,192 characters

Excel's maximum formula length is 8,192 characters. Formulas exceeding this limit — which is unusual but possible with deeply nested arrays — produce #N/A from FORMULATEXT. Consequently, this is also a sign the formula should be refactored into shorter, named components.

FORMULATEXT does not work on protected sheets: If a worksheet is protected with "Hide formulas" enabled, FORMULATEXT returns #N/A for all formula cells on that sheet. You must unprotect the sheet first. This protection setting exists precisely to prevent formula inspection — so FORMULATEXT respects it.

Frequently Asked Questions

  • What does the FORMULATEXT function do in Excel?+
    FORMULATEXT reads the formula from a specified cell and returns it as a text string. The result is exactly what you would see in the formula bar if you clicked that cell. Consequently, the formula is visible alongside the result in the worksheet — useful for documentation, teaching, and auditing. If the referenced cell contains a value rather than a formula, FORMULATEXT returns #N/A.
  • Why does FORMULATEXT return #N/A?+
    There are four common causes. First, the referenced cell contains a value, not a formula. Second, the referenced workbook is not open. Third, the worksheet is protected with formula hiding enabled. Fourth, the formula exceeds 8,192 characters. The fix for the most common case (value-only cells) is to wrap in IFERROR: =IFERROR(FORMULATEXT(A2), "No formula"). To prevent confusion in mixed columns, use this pattern consistently across all rows.
  • Can I use FORMULATEXT to find all VLOOKUP formulas in a sheet?+
    Yes. Combine FORMULATEXT with SEARCH and ISNUMBER: =ISNUMBER(SEARCH("VLOOKUP", IFERROR(FORMULATEXT(B2), ""))). This returns TRUE for any cell in column B that contains VLOOKUP in its formula. To count all occurrences across a range, wrap in SUMPRODUCT: =SUMPRODUCT(--ISNUMBER(SEARCH("VLOOKUP", IFERROR(FORMULATEXT(B2:B100), "")))). The IFERROR handles rows that contain values rather than formulas.

More Questions About FORMULATEXT

  • What is the difference between FORMULATEXT and Ctrl + ` (backtick)?+
    Ctrl + ` (backtick) toggles formula view for the entire active sheet — all cells switch between showing results and showing formulas simultaneously. This is a temporary display mode. FORMULATEXT, by contrast, is a permanent formula that extracts specific formula text into a cell. It lets you display both the formula and its result in adjacent columns simultaneously. This makes it ideal for documentation and audit sheets, not just quick inspections.
  • Does FORMULATEXT update automatically when the source formula changes?+
    Yes. FORMULATEXT is volatile — it recalculates whenever the workbook recalculates. If you edit the formula in the referenced cell, the FORMULATEXT result updates immediately to reflect the new formula text. This makes it suitable for living documentation that stays current without manual updates. However, creating a static snapshot for version control requires copying the FORMULATEXT results and pasting them as values at a fixed point in time.
  • Which Excel versions support FORMULATEXT?+
    FORMULATEXT is available in Excel 2013 and all later versions, including Microsoft 365, Excel 2024, 2021, 2019, and 2016. It also works in Excel for the web. It is not available in Excel 2010 or earlier. In Excel 365, passing a range to FORMULATEXT spills the formula text for every cell automatically. This is a significant improvement over earlier versions, where only the upper-left cell's formula was returned.