Bug 118161 - COUNTA() returns inconsistent values depending on entering separate cells or a corresponding cell range
Summary: COUNTA() returns inconsistent values depending on entering separate cells or ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:6.2.0 target:6.1.0.1 target:6.0.5
Keywords: regression
Depends on:
Blocks:
 
Reported: 2018-06-14 10:24 UTC by usack
Modified: 2022-03-24 10:40 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Minimum Working Example as described in the report (8.96 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-06-14 10:26 UTC, usack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description usack 2018-06-14 10:24:52 UTC
Description:
In a list of values that come from cell references in another table an empty value in the referenced cell will not be counted when using e.g. ANZAHL2(A1:C1) as expected. However if I use ANZAHL2(A1;B1;C1) it is counted which I would NOT expect. See MWE

Steps to Reproduce:
1.Open new file
2.Enter Values in Table2: A1=1 B1=<empty> C1=3
3.Enter cell references in Table1: A1=Table2.A1 B1=Table2...etc
4.In Table1 enter in (say) A4 =ANZAHL2(A1:C1) and in A5 =ANZAHL2(A1;B1;C1)

Actual Results:  
Table1.A4 contains 2
Table1.A5 contains 3 

Expected Results:
Table1.A5 should imho contain 2


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 5.1.6.2
Build-ID: 1:5.1.6~rc2-0ubuntu1~xenial3
CPU-Threads: 4; BS-Version: Linux 4.4; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE.UTF-8); Calc: group


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Comment 1 usack 2018-06-14 10:26:28 UTC
Created attachment 142727 [details]
Minimum Working Example as described in the report
Comment 2 Eike Rathke 2018-06-14 11:58:21 UTC
It's certainly a bug that both variants return different results, but the result should be 3 in both cases, not 2, because none of the cells in the range are empty. It also doesn't need different sheets, a simple example

A1: =COUNTA(A2:A3)
A2: =B2

gives 0 instead of 1. Entering any value in B2 yields 1. Apparently the "empty cell inherited" status in A2 is considered as empty.
Comment 3 Commit Notification 2018-06-14 13:13:53 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

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

Resolves: tdf#118161 use ScCellIterator::isEmpty() for COUNTA()

It will be available in 6.2.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 4 Eike Rathke 2018-06-14 13:20:26 UTC
Pending review
https://gerrit.libreoffice.org/55803 for 6-1
https://gerrit.libreoffice.org/55804 for 6-0
Comment 5 Commit Notification 2018-06-14 20:29:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9bec4997fe6bceabf381e07793d2c8ba38ee19da&h=libreoffice-6-1

Resolves: tdf#118161 use ScCellIterator::isEmpty() for COUNTA()

It will be available in 6.1.0.1.

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 6 Commit Notification 2018-06-14 21:12:04 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=32bcda269b07a88cecbb5a2fde10d4b4d7ce7538&h=libreoffice-6-0

Resolves: tdf#118161 use ScCellIterator::isEmpty() for COUNTA()

It will be available in 6.0.6.

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 7 Xavier Van Wijmeersch 2018-06-15 16:54:26 UTC
its working with

Version: 6.1.0.0.beta2+
Build ID: 9bec4997fe6bceabf381e07793d2c8ba38ee19da
CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
Locale: nl-BE (en_US.UTF-8); Calc: group threaded
Comment 8 Commit Notification 2018-06-18 10:21:07 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-0-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=55af68aa8929f984075fd0ae762634cde1ed29d2&h=libreoffice-6-0-5

Resolves: tdf#118161 use ScCellIterator::isEmpty() for COUNTA()

It will be available in 6.0.5.

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 9 Xisco Faulí 2022-03-24 10:40:56 UTC
The fix for this issue is already covered by sc/qa/unit/data/functions/fods/reference_operators.fods