Documentation/Calc Functions/FORMULA

From The Document Foundation Wiki
Jump to navigation Jump to search
Other languages:
English • ‎Nederlands • ‎italiano

Function name:





Displays the formula in a referenced cell as a text string.




Returns a text string which reflects the formula in the referenced cell. This string should be identical to that displayed in the Formula bar when the referenced cell is selected.


Reference is a reference to a cell containing a formula.

  • If the referenced cell is empty, or does not contain a formula, then FORMULA reports a #N/A error.
  • The FORMULA function does not propagate errors in the referenced cell. For example, if cell A1 contains the formula =SQRT(-4), then Calc reports an invalid argument error (Err:502) in cell A1. However, if cell A2 contains the formula =FORMULA(A1) then cell A2 will display the string "=SQRT(-4)" rather than the error value.
  • FORMULA does not generate an error if given a reference to the cell that it resides in. For example, the formula =FORMULA(A7) located in cell A7 simply returns the string "=FORMULA(A7)".

Additional details:

  • The FORMULA function is intended to aid understanding and debugging of spreadsheet documents by simplifying the display of formulas in other cells.
  • FORMULA can be used in an array formula by using the key combination Ctrl+Shift+Enter rather than just Enter.
  • FORMULA is a volatile function. This means that Calc will update the string returned by FORMULA when any cell is updated by selecting Data ▸ Calculate ▸ Recalculate or pressing F9, or on any input event.


Formula Description Returns
=FORMULA(A1) where cell A1 contains the formula =1/0 Here the function returns a string representation of the formula in cell A1. It does not propagate the #DIV/0! error that is displayed in cell A1. "=1/0"
=FORMULA(D8) where cell D8 contains the formula =SUM(1; 2; 3) Here the function returns a string representation of the formula in cell D8. "=SUM(1; 2; 3)"

Related LibreOffice functions:


ODF standard:

Section 6.13.12, part 2

Equivalent Excel functions: