Search code examples
libreoffice-calc

LibreOffice Calc: check if cell is a formula


I want to implement some conditional formatting in LibreOffice Calc (v5.4.4.2 but can upgrade) that will highlight cells whose values are calculated through a formula rather than entered directly.

For example, a cell containing

=A3

will be highlighted, while

Hello world!

in cell A3 will not be.

I understand conditional formatting, etc; I just need to determine the correct formulae for checking if a cell actually contains a formula.


Solution

  • For a simple solution without conditional formatting, enable "Value Highlighting" (CTRL+F8). This will modify the font color automatically:

    • formula results appear in green,
    • numerical values in blue,
    • text in black.

    If you need custom formatting (e.g. setting the cell background, or restrict the formatting to formula results), just use the ISFORMULA() function. To create a conditional formatting rule for range B3:D5, just define a conditional formatting rule with Formula set to ISFORMULA(B3) - LO will apply it to the complete range, adapting the parameter automatically.