ID EN
#Lookup and reference

FORMULATEXT

Excel Functions

Get the formula in a cell

Syntax

EXCEL
=FORMULATEXT(reference)

Arguments

Parameter Description
reference Reference to cell or cell range.

Return Value

The formula as text

Details

The FORMULATEXT function returns a formula as a text string from a cell reference. The FORMULATEXT can be used to extract a formula as text from a cell reference. The text returned by FORMULATEXT is the same as displayed in the formula bar when a cell with a formula is selected. Once text is extracted with FORMULA text, it can be handled as text in another formula. FORMULATEXT takes just one argument, reference, which is normally a cell reference like A1. If you use FORMULATEXT on a cell that doesn't contain a formula, it returns #N/A. FORMULATEXT will handle formulas up to 8192 characters. In Excel 365, the FORMULATEXT function will return more than one result when given a range that contains formulas. These results will spill like other dynamic array formulas. In earlier versions of Exce

Examples

Examples

Assuming the formula =TODAY() in cell A1:

EXCEL
=FORMULATEXT(A1) // returns "=TODAY()"
Examples

With the formula =C1+B1 in cell D1:

EXCEL
=FORMULATEXT(D1) // returns "=C1+B1"
Examples

With the text "apple" in cell F1:

EXCEL
=FORMULATEXT(F1) // returns #NA!
Examples

One quirk of FORMULATEXT is that it will not display a circular reference error if given a reference to the same cell it resides in. For example, if t

EXCEL
=FORMULATEXT(A1) // returns =FORMULATEXT(A1)

See Also

ISFORMULA