Conditional number format in Calc

I would like to display numbers in a Calc spreadsheet such that:

  • if the field is empty, nothing displays
  • if the number entered is an integer it will display with zero
    decimal places
  • if the number entered
    is not an integer it will display to
    2 decimal places

What is the best way to do this, please?

In the number formatter (Format → Cells, Numbers) create a format with format code 0.## (use your locale’s decimal separator instead of . dot) and apply that number format to cells.

Thank-you!