FORMULATEXT function
The FORMULATEXT function in Excel is used to return a formula as a text string. This is helpful when you want to display the actual formula used in a cell rather than the result of the formula.
Syntax:
=FORMULATEXT(reference)
- reference: The cell containing the formula you want to display as text.
Example 1: Displaying a Formula in Another Cell
If cell A1 contains the formula:
=B1 + C1
and you use the FORMULATEXT function in cell D1:
=FORMULATEXT(A1)
It will return:
=B1 + C1
This displays the actual formula used in cell A1 as a text string.
Example 2: Displaying the Formula of a Complex Calculation
If you have a complex formula in cell B2, such as:
=IF(A1 > 10, A1 * 2, A1 + 5)
and you use FORMULATEXT in another cell (e.g., C2):
=FORMULATEXT(B2)
It will display:
=IF(A1 > 10, A1 * 2, A1 + 5)
This shows the exact formula in cell B2.
Example 3: Error Handling
If the specified reference does not contain a formula (e.g., the cell contains a value instead), the FORMULATEXT function will return an error message #N/A.
For example, if A1 contains the value 5 (not a formula), and you use:
=FORMULATEXT(A1)
It will return:
#N/A
Benefits:
- Transparency: Allows you to see the actual formulas used in a worksheet, which is helpful when auditing or documenting complex workbooks.
- Error Checking: Can help identify issues in formulas by showing you the exact formula used in a cell.
- Learning and Debugging: Useful for teaching or debugging purposes to display how formulas are constructed.
Use Cases:
- Documenting Formulas: If you are creating a guide or manual and want to display the formulas used in specific cells.
- Formula Auditing: When auditing a spreadsheet, it can be useful to see the formulas in each cell instead of the values.
- Debugging Complex Formulas: When working with complex formulas,
FORMULATEXThelps you quickly identify mistakes or check what formula is being used in a given cell.
In summary, the FORMULATEXT function is a helpful tool for viewing and displaying the actual formulas in a worksheet as text, making it easier to audit, document, and troubleshoot your work.