Bug 86219 - EDITING: MOD (and others) function fails when both arguments are arrays
Summary: EDITING: MOD (and others) function fails when both arguments are arrays
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:4.4.0 target:4.3.5
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-12 20:19 UTC by GerardF
Modified: 2019-05-30 11:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
sheet with examples of array formula (11.51 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-11-12 20:19 UTC, GerardF
Details

Note You need to log in before you can comment on or make changes to this bug.
Description GerardF 2014-11-12 20:19:03 UTC
Created attachment 109368 [details]
sheet with examples of array formula

=MOD(A2:A4;B1:C1) used in array formula returns an array with MOD(A2;B1) in the 1st cell and #VALUE! for all the other cells.

Using onky one array and a scalar for args works correctly. (MOD(A2:A4;B1) for example.

Other functions expected 2 scalars as argument have the same behavior.
Like CEILING, FLOOR...

I've just used Excel for some weeks 4 years ago (so I'm not 100% sure) and I think Excel can handle this formula.
Comment 1 Eike Rathke 2014-11-12 21:33:50 UTC
Apparently the scalar from array extraction lacks vector replication here.
Note that when the arguments are of equal dimensions or both are column vectors or row vectors the expression works, e.g. {=MOD(A2:A4;B1:B3)} is fine.
Comment 2 Commit Notification 2014-11-12 22:09:11 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9807d4498cd0c759019e36c822bca3b5ea563600

fdo#86219 use vector replication when obtaining scalar for jump matrix

It will be available in 4.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 3 Eike Rathke 2014-11-12 22:28:04 UTC
Pending review for 4-3 at https://gerrit.libreoffice.org/12394
Comment 5 Bruce Martin 2019-05-12 03:55:38 UTC
Example:

(Fedora 28, 64 bit):

=IF($BG23<5,””,(SUM($E$5:$E19)+SUM($E$19:$E$21)))

This results in a failure, in spite of trying to make the calc abort if $BG2 is less than 5.

Having tried many combinations and tracked some of them in an independent text (code snippets" file, the only way I had to resolve this was to do the calc from the third argument in a separate cxell then have the original cell access it conditionally.

Calc also may crop my formula when I paste it in, if this problem exists.

In order to discern what was going on, I had to compose my formulas in an independent file and annotate that so as to keep track of what worked and what didn't.

(This is part of a calc to feed a Canadian tax return for a Quebec resident - "taxing"!)


Hence the resolution ended up being to place

SUM($E$5:$E19)+SUM($E$19:$E$21)

in Cell 4G$23,

Then use

=IF($BG23>-4,$G$23,"")

To resolve the next level result.
=IF($BG23>-4,$G$23,"")
Comment 6 Xisco Faulí 2019-05-30 11:10:54 UTC
Hello Bruce Martin,
This bug has been in RESOLVED FIXED status for more than 4 years.
If the issue is still reproducible with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/, please report a new issue in https://bugs.documentfoundation.org/enter_bug.cgi providing, if     needed, the steps and documents to reproduce it.
Thanks for your understanding and collaboration.
Closing as RESOLVED FIXED