The FORMULATEXT function returns a formula as a text string.

  • This function was introduced in Excel 2013 and so is not available in earlier versions.

Syntax

=FORMULATEXT(reference)

Arguments

Argument Description
reference A reference to a cell or range of cells

Examples

  A B C D E
1 Data   Formula Result Notes
2 32   =FORMULATEXT(A6) =SUM(A2:A5) The formula in C2 returns the formula it finds in cell A6 as a text string so that you can easily inspect its structure
3 12        
4 10        
5 40        
6 94        

Common Function Error(s)

Problem What went wrong
#VALUE! Occurs if the supplied reference argument is not a valid cell reference
#N/A Occurs if either:

  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; e.g. due to worksheet protection
  the reference cell is in a workbook that is not currently open in Excel