Bug 130734 - COUNTIFS function not evaluating correctly when not only checking for equality
Summary: COUNTIFS function not evaluating correctly when not only checking for equality
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-17 13:10 UTC by karoshi
Modified: 2020-02-17 14:14 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Countifs works in LO 5.x, broken since 6.0 (10.52 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-02-17 13:10 UTC, karoshi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description karoshi 2020-02-17 13:10:26 UTC
Created attachment 157945 [details]
Countifs works in LO 5.x, broken since 6.0

Countifs is defined to count 1 when all criteria are met which seems not to work properly when not only comparing with some fixed content.

The attached file shows a countifs of 1 in both cases when opened in LibreOffice Calc 5.9 (correct).

But 2 for the first value (incorrect), 1 for the latter (correct) when opened in 6.0 through 6.4.

The issue has appeared in a disclosed document so I created a minimal test as attached.
Comment 1 Eike Rathke 2020-02-17 13:44:27 UTC
The result 2 in A9 is correct. The formula is
=COUNTIFS($A$2:$A$5; "foo"; $B$2:$B$5;"<>''")
The Criteria "<>''" matches all cells where the content is not the literal string '' (two consecutive appostrophes). The "''" does *not* denote an empty string. If you wanted to match non-empty cells then the Criteria argument should be "<>", i.e. only the <> operator without further value.

I don't recall what 5.9 may have done there, but if the result was 1 in that case then it was wrong. There was some bug with the IFS() function.
Comment 2 karoshi 2020-02-17 14:14:39 UTC
Even better. Thanks a lot!