Formulatext() Function

The Excel FORMULATEXT function returns a formula as a text string from given reference. You can use FORMULATEXT to extract a formula as text from a cell. If you use FORMULATEXT on a cell that doesn’t contain a formula, you’ll get an #N/A error.

Syntax

The syntax for the FORMULATEXT function in Microsoft Excel is:

=FORMULATEXT (reference)

reference

Reference to cell or cell range.

FormulaText Function Example

The Excel FormulaText function is used in cell C1 of the following spreadsheet, to display the formula from cell B4.

Formula:

Result:

Remarks

  • FORMULATEXT was introduced in Excel 2013.
  • The FORMULATEXT function returns what is displayed in the formula bar if you select the referenced cell.
  • The Reference argument can be to another worksheet or workbook.
  • If the Reference argument is to another workbook that is not open, FORMULATEXT returns the #N/A error value.
  • If the Reference argument is to an entire row or column, or to a range or defined name containing more than one cell, FORMULATEXT returns the value in the upper leftmost cell of the row, column, or range.
  • In the following cases, FORMULATEXT returns the #N/A error value:
    • The cell used as the Reference argument does not contain a formula.
    • The formula in the cell is longer than 8192 characters.
    • The formula can’t be displayed in the worksheet; for example, due to worksheet protection.
    • An external workbook that contains the formula is not open in Excel.
    • Invalid data types used as inputs will produce a #VALUE! error value.
  • Entering a reference to the cell in which you are entering the function as the argument won’t result in a circular reference warning. FORMULATEXT will successfully return the formula as text in the cell.