Bug 61172

Summary: TABLE: Weird formula syntax to calculate the sum of non-adjacent cells
Product: LibreOffice Reporter: Martin Vogel <mail>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED NOTABUG    
Severity: normal CC: miguelangelrv
Priority: medium    
Version: 3.6.4.3 release   
Hardware: Other   
OS: Linux (All)   
Whiteboard: BSA
Crash report or crash signature: Regression By:
Attachments: Writer document with table
Screenshot of Writer table

Description Martin Vogel 2013-02-20 15:39:32 UTC
I tried to calculate the total sum of the two cell ranges C2 to C16 and G2 to G16.

The formula I used was
= sum(<C2:C16>)+sum(<G2:G16>)
it resulted in an error message:
** Fehlerhafter Ausdruck ** (erroneous expression?)

When i try the weird (and possibly undocumented) syntax
= sum(<C2:C16>+<G2:G16>)
the calculation works.

When i try the Microsoft-Word-like
= sum(<C2:C16>;<G2:G16>)
the result is zero! No error message is being shown.



              
Operating System: Ubuntu
Version: 3.6.4.3 release
Comment 1 m_a_riosv 2013-02-20 23:59:01 UTC
Hi Martin, thanks for reporting.

I think it is not a bug, the syntax is wrong. Try:
=sum(c2:c16;g2:g16) or =sum(C2:C16)+sum(G2:G16)

If you have questions about the use, I think is better ask first in:
http://ask.libreoffice.org/en/questions/

The documentation link:
https://wiki.documentfoundation.org/Documentation/Publications#LibreOffice_Calc_Guide

If you are not agree with the status change, please reopen explain in detail the bug, the Operating system and LibreOffice version
Comment 2 Martin Vogel 2013-02-21 09:43:54 UTC
Created attachment 75243 [details]
Writer document with table

The document belonging to the screenshot
Comment 3 Martin Vogel 2013-02-21 09:44:41 UTC
Created attachment 75244 [details]
Screenshot of Writer table
Comment 4 Martin Vogel 2013-02-21 09:46:11 UTC
mariosv, your example works perfectly in Microsoft Office Word, but not in LibreOffice Writer.
Comment 5 m_a_riosv 2013-02-21 09:52:02 UTC
Hi Martin, please sorry, I was thinking in calc.

The following formulas works for me:
=<A1:A2>+<B1:B2>
=sum <A1:A2>+sum <B1:B2>
Comment 6 Martin Vogel 2013-02-21 10:13:38 UTC
mariosv, thank you for your help, both of your examples work. 

This leads to another problem. I thought, sum() was a function, but by its syntax it is a kind of command. Ok, I can live with that. But there still is the misleading function summe() which returns not the sum of a list, but its last member.

=summe(3;4;5)

does not result in 12, but 5!

So 

=summe(<A1:A2>+<C1:C2>)

is equivalent to

=<A1:A2>+<C1:C2>

but

=summe(<A1:A2>;<C1:C2>)

returns

=<C1:C2>


I will change the heading of the bug to make it more specific. Maybe the correct syntax could be shown by an example in the help text so that it becomes clear that the brackets have to be avoided.