Frequently asked questions - Calc
My IF function returns TRUE or FALSE instead of a number
Cells having their number format set to Boolean will display numbers as either TRUE or FALSE.
Sometimes, while editing formulas, one can inadvertently set a cell's format to logical (Boolean Value). Then, after one writes the final variant of the formula, sees that instead of an expected numeric value, only TRUE or FALSE is displayed in the cell. It is because any non-zero number is treated as TRUE when treated as logical value; zero is FALSE.
To fix the problem, set the desired numeric number format, or use Clear Direct Format (Ctrl+M) function for the default General format.