FORMULATEXT Function¶
The FORMULATEXT function in Excel is used to return the formula in a given cell as text. It displays the actual formula rather than the calculated result, which is useful for documentation, auditing, or troubleshooting spreadsheets.
Key Features of FORMULATEXT:¶
- Returns the exact formula as it appears in the formula bar.
- Shows formulas from other cells without having to navigate to them.
- Useful for formula auditing and creating documentation.
- Returns an error if the referenced cell doesn't contain a formula.
Syntax:¶
- reference: A reference to a cell that contains a formula you want to display as text.
How FORMULATEXT Works:¶
- Excel looks at the specified cell reference.
- If the cell contains a formula, it returns that formula as a text string.
- If the cell contains a value (not a formula), it returns a
#N/Aerror. - The returned text includes the leading equals sign (=) and the complete formula.
Examples:¶
1. Display a Simple Formula:¶
If cell A1 contains the formula =B1+C1:
Result:
2. Show Complex Formulas:¶
If cell D5 contains =VLOOKUP(A2,Table1,3,FALSE):
Result:
3. Error When No Formula Exists:¶
If cell A1 contains the value 100 (not a formula):
Result:
4. Create Formula Documentation:¶
If A1 contains =SUM(B1:B10) and evaluates to 500:
Result:
Notes:¶
FORMULATEXTreturns a#N/Aerror if the referenced cell contains a value instead of a formula.- The function is available in Excel 2013 and later versions.
- Returns the formula exactly as entered, including any spaces or formatting.
- Works with array formulas and will show the complete array syntax.
- Cannot reference cells from closed workbooks.
Applications:¶
- Formula Auditing: Quickly view formulas in multiple cells without clicking on each one.
- Documentation: Create lists of formulas used in your workbook for reference.
- Quality Control: Check that formulas are consistent across similar calculations.
- Training Materials: Show both the formula and result in educational spreadsheets.
- Troubleshooting: Identify formula differences when debugging calculation errors.
Error Handling:¶
You can combine FORMULATEXT with error handling to make it more robust:
This will display the formula if one exists, or a custom message if the cell contains only a value.