Summing fractions return wrong value

I have noticed this strange behaviour in the =sum() function in calc.

D1 contains the =sum(a1:c1) formula, as indicated in the screenshot.

Is sum only adding integer values and ignore float values?

Any suggestions on how this can be rectified?

Format D1!

Format it to 6.0?
The summed answer should be 8.5, so the fact that I did not format it correctly doesn’t change a thing.

Some issues vanish next to immediately if their cause gets obvious.
Therefore: Avoid explicit horizontal alignment for cells wherever possible (which means next to always).
The horizontal ‘Default’ alignment works by displaying texts left aligned and numbers right aligned. Using this clever setting you will never again puzzle about why something looking like a number isn’t processed as one.
If you want to have some distance between cell grid lines and cell contents you can use the ‘Padding’ (left, right) settings under ‘Borders’ for your formatting.

Hello,

most probably your 2.5 is not a number but text (see decimal delimiter in your locale) and text is 0 when used in SUM(). Thus 2 options:

  • Change the value to 2,5 – or –
  • Change your locale, which has a . as a decimal delimiter (e.g. English (USA)

PS: If comment from @Hrbrgr would apply, you’d get 8

  1. How do you apply D1! format?
  2. How do you get the red text and grey boxes?

Do you mean locale setting - if yes: Tools -> Options -> Language Settings -> Languages -> Dropdown: Locale setting.

Add 1) Not at all - you entered 2.5 and obviously you are using a locale setting, which has , (comma) as a decimal delimiter. Thus LibreOffice doesn’t recognize the data inserted as a number and stored it as text. BTW: That’s why it is a bad idea to change the justification of your cells to center-alignment. If LibreOffice recognizes a number it get automatically right aligned and if an input is considered tect by LibreOffice it gets left aligned. So you’d have a direct indication how LibreOffice interpreted your values (very important for dates and times, since these are also numbers in LibreOffice).

Add 2) See the small icon in edit mode showing 101010 and help text preformatted text when hovering over the icon.

Thank you very much.

See also this FAQ.