Quantcast
Channel: Apache OpenOffice Community Forum
Viewing all articles
Browse latest Browse all 1281

Calc • Re: [Solved] Unexpected result for SUM with multiplication

$
0
0
Is that a case of intersection (mentioned e.g. in AOO Help)?
Same row that looks like the default intersection mentioned by cwolan when there is nothing to define an intersection.
Yes. It is explained in Using Arrays → Functions not expecting array parameters → If it is a range → For a single row or a single column range. In this context, the multiplication operator can be regarded as a function which does not expect array parameters. E5:E14 is a single column range, so the intersection is made with the current cell's row. If the intersection of a range and the current cell is null, the result is #VALUE!.

If you enter your original formula as an array formula, i.e. with Ctrl+Shift+Enter, it will show 40 as the result.
Fine for you and me. I knew that but didn't mention it because array formulas are an advanced topic. I do not recommend that beginners use them since they can be difficult to understand and have many quirks and issues, some of which are mentioned at the bottom of the link above. I know of cases where array formulas behave strangely and have helped people in topics who have bumped into them. The best way for a beginner to perform this particular calculation is with =SUM(E5:E14)*2, not an array formula. The question in this topic suggests to me that peanutaxis does not understand some of the very basic Calc concepts (like when ranges are allowed in formulas) and doesn't need any additional complexity now.

I will concede that there are some situations where an array formula is the only reasonable way to perform a calculation, but this is not one of those. Multiplication distributes over the addition from SUM and can be moved to the outside. If the operator inside the function were addition instead of multiplication =SUM(E5:E14+2) would either need an array formula, =SUMPRODUCT(E5:E14+2), or SUM() and a helper column with the incremented values. For a beginner I would suggest the latter, even though I wouldn't usually use a helper column myself. This is a case of Do as I say, not as I do. I didn't know, until creating the link, that the original appearance of that phrase is the New Testament.

Statistics: Posted by MrProgrammer — Sat Jun 15, 2024 10:06 pm



Viewing all articles
Browse latest Browse all 1281

Trending Articles