The FORMULATEXT function in Excel is a valuable tool that enables users to retrieve the text of a formula from a specified cell reference. This function is particularly useful for auditing and debugging spreadsheets, allowing users to easily view formulas instead of values. By accessing the underlying formula in a simple text format, users can better understand the calculations taking place within their worksheets.
Syntax
FORMULATEXT(reference)
- reference: This parameter represents the cell reference from which the formula will be extracted as text.
Example #1
=FORMULATEXT(A1)
When called, this function retrieves the formula in cell A1 as text. For example, if A1 contains the formula “=SUM(B1:B10)”, the result will be “=SUM(B1:B10)”.
Example #2
=FORMULATEXT(C3)
This function provides the formula used in cell C3. If C3 has the formula “=A1A2”, the output will display “=A1A2” as a text string.
Example #3
=FORMULATEXT(D5)
Here, the formula within cell D5 will be returned as text. For instance, if D5 contains “=AVERAGE(E1:E5)”, the result will be “=AVERAGE(E1:E5)”.
Error handling
- N/A: This error occurs if the reference provided does not contain a formula; only values are present.
- REF!: This error message indicates that the referenced cell is not valid, often due to deleted rows or columns.
- VALUE!: This error appears when the argument provided is of the wrong type, such as non-cell references.