[Solved] Simple sum is wrong

Discuss the spreadsheet application
Locked
linz
Posts: 2
Joined: Tue Dec 03, 2024 4:38 pm

[Solved] Simple sum is wrong

Post by linz »

i have used tried a simple calculation but it seems to be adding up wrong its 1p out

£5.46 + £21.34 + £0.71 = should be £27.51 but it keeps giving me £27.52
spreadsheet attached
Attachments
Electric invoice template.ods
(18.98 KiB) Downloaded 60 times
Last edited by MrProgrammer on Sat Dec 07, 2024 7:58 pm, edited 3 times in total.
Reason: Add "sum" to title
OpenOffice 4.1.15 on windows 11 Home
User avatar
Hagar Delest
Moderator
Posts: 33630
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: simple calculation adding up wrong

Post by Hagar Delest »

Hi and welcome to the forum!

This is due to the display of rounded numbers.
They display with 2 digits as:
£5.46
£21.34
£0.71
However, the true value is (increase the number of digits):
£5.460
£21.344
£0.713
Thus leading to £27.517, rounded to... £27.52.

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Simple calculation adding up wrong

Post by Zizi64 »

There is an option in the LO Calc - Calculate settings: "Precision as shown".
You can try it.

...I never use it.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
linz
Posts: 2
Joined: Tue Dec 03, 2024 4:38 pm

Re: Simple calculation adding up wrong

Post by linz »

is there any way to change it so it adds up to the ignoring all the other decimal places? so the answer is £27.52?
OpenOffice 4.1.15 on windows 11 Home
User avatar
robleyd
Moderator
Posts: 5505
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Simple calculation adding up wrong

Post by robleyd »

Use ROUND() on your calculations to limit the values to two decimals. For example in F18 use:

Code: Select all

=ROUND(B18 * D18; 2)
Slackware 15 (current) 64 bit
Apache OpenOffice 4.1.16
LibreOffice 26.2.3.2; SlackBuild for 26.2.3 by Eric Hameleers
---------------
I hate this damn computer, I wish that I could sell it.
It won't do what I want it to, Only what I tell it.
User avatar
Zizi64
Volunteer
Posts: 11505
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Simple calculation adding up wrong

Post by Zizi64 »

is there any way to change it so it adds up to the ignoring all the other decimal places? so the answer is £27.52?
You can ROUND the operands and/OR the results.

Or you can use the "Precision a shown" option for the Calc application.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Hagar Delest
Moderator
Posts: 33630
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Simple calculation adding up wrong

Post by Hagar Delest »

Zizi64 wrote: Wed Dec 04, 2024 10:57 am You can ROUND the operands and/OR the results.
My 2 cents: round each detail line, thus the result will show the exact sum of the lines.
If you round the result only and someone sums each line then he can complain that there is a discrepancy.

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Locked