Bug 88255 - array formula implementing OR and AND functions between each elements at same position
Summary: array formula implementing OR and AND functions between each elements at same...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.7.2 release
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-09 20:48 UTC by Jérôme
Modified: 2015-01-13 10:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
truth table of current and expected OR and AND formulas (25.86 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-01-10 13:31 UTC, Jérôme
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jérôme 2015-01-09 20:48:48 UTC
When using "OR" and "AND" formula on 2 arrays of same sizes, the result is equivalent to :
- the "OR" operator between [the result of "OR" operator between all cells of the 1st array] and [the result of "OR" operator between all cells of the 2nd array]
- the "AND" operator between [the result of "AND" operator between all cells of the 1st array] and [the result of "AND" operator between all cells of the 2nd array]

I would like array functions which provide the result of "OR" and "AND" between the elements of the 2 arrays which have the same position.

The array result would be built as below :
- row 1 and column 1 is the result of the cell function bewteen the cell at row 1 and column 1 of the 1st array and the row 1 and column 1 of the 2nd array,
- ...
- row R and column C is the result of the cell function bewteen the cell at row R and column C of the 1st array and the row R and column C of the 2nd array,
- etc

Currently, the work around I found is a painfull use of nested IF formulas on arrays.
Comment 1 GerardF 2015-01-09 21:17:08 UTC
In which kind of formula? can you provide an example?
Since 4.0 BITOR, BITAND and BITXOR are available and I think they can do what you expect of OR & AND.
Comment 2 Jérôme 2015-01-10 13:31:03 UTC
Created attachment 112055 [details]
truth table of current and expected OR and AND formulas

The feature I need is currently implemented with IF formula.

If I have more than 2 arguments, the IF are nested and that isn't easily readable. Moreover, it increases the size of the formula to be parsed.
Comment 3 GerardF 2015-01-10 14:28:21 UTC
AND/OR works like LO Calc with any spreadsheet software and it is expected:
These functions expect scaler or range arguments like many other functions.
For example =SUM(array1 ; array2) adds alls value even in array formula.

And this cannot be change because it would not be possible to pass arguments to the function with another array formula.

Just replaces AND & OR by BITAND & BITOR and you will have expected result.
Note that these formula are showing 1/0 as result. You can format cells as Boolean if you need to see TRUE/FALSE.
Comment 4 Jérôme 2015-01-10 19:49:06 UTC
Thanks. I will use BITOR and BITAND when my office will update our libreoffice to the 4 version.