Bug 148931 - Sum doubles quantity if for only one line
Summary: Sum doubles quantity if for only one line
Status: VERIFIED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-04 14:09 UTC by Don
Modified: 2022-05-05 03:50 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Don 2022-05-04 14:09:11 UTC
Description:
In LbreOffice Calc the sum function when used for a single line only like Sum(C21,C21) doubles the amount of line C21. I don't know why anyone would want to do that, but the function needs to take this possibility into account.

Steps to Reproduce:
1.Put 9 in Cell 21
2.Put Sum(C21,C21) in Cell C25
3.

Actual Results:
18

Expected Results:
9


Reproducible: Always


User Profile Reset: No



Additional Info:
Function should take into account a user like me, may be stupid enough to use a sum function for one cell. In my case I will at a later date will change the function to include more cells.  I know I could just add to include an empty cell and the function would work.
Comment 1 Mike Kaganski 2022-05-04 14:49:46 UTC
This is completely correct behavior of SUM. It sums whatever you put there. It is exactly like you would write "x+x" and expect the result to be x, not 2x.
Comment 2 Don 2022-05-05 02:04:31 UTC
I noticed that while Sum(C21,C21) doubles the contents of cell 21, Sum(C21:C21) does not.
Comment 3 Mike Kaganski 2022-05-05 03:50:36 UTC
(In reply to Don from comment #2)
> I noticed that while Sum(C21,C21) doubles the contents of cell 21,
> Sum(C21:C21) does not.

Indeed. Sum(C21,C21) is a call of SUM with *two* arguments, where each argument is the cell value, identical to "C21+C21"; while Sum(C21:C21) is a call with *one* argument, which is "a range of cells from C21 to C21", which is just a single cell.

You simply need to read the basics of spreadsheets: see "Calc Guide" at https://documentation.libreoffice.org/en/english-documentation/.