The Excel FORMULATEXT Function

Function Description

The Excel FormulaText function returns a formula as a text string.

Note: The FormulaText function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.

The syntax of the function is:

FORMULATEXT( reference )

where the reference argument is a reference to a cell in an Excel worksheet. This may be in a different worksheet in the current workbook, or in another workbook that is currently open.

If the supplied reference refers to a workbook that is not currently open, the FormulaText function will return the #N/A error.


FormulaText Function Example

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

 Formula:
  A B C
1   25 =FORMULATEXT( B4 )
2   31  
3   28  
4 SUM: 84  
 Result:
  A B C
1   25 =SUM(B1:B3)
2   31  
3   28  
4 SUM: 84  

For further details and examples of the Excel FormulaText function, see the Microsoft Office website


FormulaText Function Errors

If you get an error from the Excel FormulaText function, this is likely to be one of the following:

Common Errors
#N/A -

Occurs if the supplied cell reference:

  • Relates to a cell that does not contain a formula
or
  • Relates to a cell whose formula is more than 8192 characters long
or
  • Relates to a cell whose formula cannot be viewed (for example if it is protected)
or
  • Relates to a cell in a workbook that is not currently open in Excel.
#VALUE! - Occurs if the supplied reference is not a valid cell reference.