Bug 152091 - Addition of several groups of contiguous cells gives "#Value!"
Summary: Addition of several groups of contiguous cells gives "#Value!"
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.2.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-17 18:08 UTC by Julien Nabet
Modified: 2022-11-22 19:10 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
testfile (9.70 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-11-18 07:56 UTC, Julien Nabet
Details
test file for formula = single-row or single-column cell range (LO 7.5 alpha) (16.46 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-11-21 10:01 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Nabet 2022-11-17 18:08:49 UTC
Description:
On pc Debian x86-64 with LO 7.4.2.3, I got "#Value!" when trying a formula like:
=A1:A2+A5:A6+A9:A10

I must recognize I'm not sure if it's a bug or not. Perhaps it's the way it should be.

Steps to Reproduce:
1. Retrieve attachment
2. See A13


Actual Results:
#Value!

Expected Results:
Either 210
or if we absolutely want to mimick Excel:
90
120


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.4.2.3 / LibreOffice Community
Build ID: 40(Build:3)
CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Debian package version: 1:7.4.2-3
Calc: threaded

I could also reproduce this with master sources updated today.
Comment 1 LeroyG 2022-11-17 22:47:46 UTC
I think that it is not a bug.

You must opt for =SUM(A1:A2;A5:A6;A9:A10) (or not usually with =SUM(A1:A2~A4:A5~A7:A8))

=A1:A2;A5:A6;A9:A10 will give Err:509 Operator missing.

Just try in B1 with =A1:A2 and you will get only the A1 value. And with the same formula in B2 you will get only the A2 value.

Tested with:
Version: 7.3.6.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 1; OS: Linux 5.14; UI render: default; VCL: gtk3
Locale: es-MX (en_US.UTF-8); UI: en-US
Calc: threaded

(In reply to Julien Nabet from comment #0)
> 1. Retrieve attachment

Attachment is missing.
Comment 2 m_a_riosv 2022-11-18 00:20:53 UTC
Or introducing it as an array, you get two cells result. The first summing A1+A5+A9 and second one A2+A6+A10.

For me not a bug.
Comment 3 estesprit-LO 2022-11-18 07:40:22 UTC
=A1:A2 doesn't tell Calc what to do with this matrix, do Calc cannot know the user wants to sum the matrix. LeroyG is right, OP should tell Calc about it by using the SUM function.

Not a bug.
Comment 4 Julien Nabet 2022-11-18 07:56:50 UTC
Created attachment 183657 [details]
testfile

Sorry I had forgotten the attachment.

BTW, sum in status bar at bottom right (don't know if it's the right naming) provides correct sum, 210, so Calc considers it as a plain sum in this case.
Comment 5 Julien Nabet 2022-11-18 08:00:32 UTC
(In reply to Julien Nabet from comment #4)
> Created attachment 183657 [details]
> testfile
> 
> Sorry I had forgotten the attachment.
> 
> BTW, sum in status bar at bottom right (don't know if it's the right naming)
> provides correct sum, 210, so Calc considers it as a plain sum in this case.

Unless because it would be equivalent here as =SUM(A1:A2;A5:A6;A9:A10) which indeed works.

So if this one isn't considered as a bug, at least it means we mustn't mimick Excel in all cases (because I consider its result, 90 120, not intuitive here) :-)
Comment 6 Julien Nabet 2022-11-18 08:04:50 UTC
(In reply to LeroyG from comment #1)
> ...
> =A1:A2;A5:A6;A9:A10 will give Err:509 Operator missing.
Indeed

> Just try in B1 with =A1:A2 and you will get only the A1 value. And with the
> same formula in B2 you will get only the A2 value.
>
Yes and if I do =A1:A2 in A18, I got "#VALUE!" quite weird!
Comment 7 LeroyG 2022-11-18 11:52:48 UTC
(In reply to Julien Nabet from comment #6)
> (In reply to LeroyG from comment #1)
> > Just try in B1 with =A1:A2 and you will get only the A1 value. And with the
> > same formula in B2 you will get only the A2 value.
> >
> Yes and if I do =A1:A2 in A18, I got "#VALUE!" quite weird!

Not weird, because formula references only until A2. Change the formula to =A1:A10 and you will get "0". Otherwise use =SUM(A1:A2).
Comment 8 Stéphane Guillou (stragu) 2022-11-21 09:59:42 UTC
(In reply to LeroyG from comment #1)
> I think that it is not a bug.
> 
> You must opt for =SUM(A1:A2;A5:A6;A9:A10) (or not usually with
> =SUM(A1:A2~A4:A5~A7:A8))
> 
> =A1:A2;A5:A6;A9:A10 will give Err:509 Operator missing.
> 
> Just try in B1 with =A1:A2 and you will get only the A1 value. And with the
> same formula in B2 you will get only the A2 value.

I was trying to see where this interesting "formula that is a cell range will return the unambiguous value located at the corresponding coordinate" behaviour is documented, but couldn't find it:

- https://help.libreoffice.org/latest/en-US/text/scalc/guide/relativ_absolut_ref.html
- https://help.libreoffice.org/latest/en-US/text/scalc/guide/formulas.html
- https://help.libreoffice.org/latest/en-US/text/scalc/guide/formula_enter.html

Any idea where that is / where it should be? If it is an expected behaviour, we should turn this bug into a documentation issue.
Comment 9 Stéphane Guillou (stragu) 2022-11-21 10:01:34 UTC
Created attachment 183695 [details]
test file for formula = single-row or single-column cell range (LO 7.5 alpha)

To show different cases of formulas that simply reference cell ranges.
Comment 10 Julien Nabet 2022-11-21 11:00:51 UTC
(In reply to Stéphane Guillou (stragu) from comment #8)
> 
> Any idea where that is / where it should be? If it is an expected behaviour,
> we should turn this bug into a documentation issue.

No idea here but perhaps Eike will have some opinion here.
Comment 11 LeroyG 2022-11-21 12:02:56 UTC
(In reply to Stéphane Guillou (stragu) from comment #9)
> Created attachment 183695 [details]
> test file for formula = single-row or single-column cell range (LO 7.5 alpha)
> 
> To show different cases of formulas that simply reference cell ranges.

If there are no values at all in A2:A7 and in A14:F14, likewise you will get "#Value!".

Following what I understood, A10 and H14 are an attempt of self-referencing formulas, but off the valid range of the formula.

Try with "=A2:A7" (formula in C3) in C8. You gets "#Value!".
Comment 12 Julien Nabet 2022-11-21 12:05:46 UTC
Ok if everyone agrees it's expected, let's not waste more time on this and consider it as NOTABUG.
Comment 13 Eike Rathke 2022-11-22 19:07:22 UTC
The behaviour is expected. If a function or operator expects a single scalar value but the argument is a cell range and the formula expression is not in array mode, an implicit intersection of the formula cell's position and the cell range argument is taken. If such is not possible because the position and the range are not intersect-able or the range is not a column vector or row vector with a single dimension in the intersection direction, an error is returned.

For example the reference A1:A2 is intersect-able anywhere on row 1 or row 2, but not on other rows nor anywhere in column A (because then there is no single cell intersection).

See also ODFF 6.3.3 Implied Intersection
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1017984_715980110
Comment 14 Eike Rathke 2022-11-22 19:10:11 UTC
Btw, the results of 90 and 120 are if the formula is in array mode, i.e. close the input with Shift+Ctrl+Enter instead of just Enter, same results as in Excel.