Bug 123785 - count functions count also empty fields
Summary: count functions count also empty fields
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.3.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-01 11:47 UTC by burkhard.kasten
Modified: 2019-03-01 20:09 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description burkhard.kasten 2019-03-01 11:47:49 UTC
Description:
Commands like

 =ZÄHLENWENN(B11:B85;"<>0")
or
 =COUNTIF(D11:D85;"<>0")

count also empty fields.


Fields which contain 0 are not counted (correct)
Fields which contain nothing are counted (wrong)



Steps to Reproduce:
Create a new Calc file
Select field A1
Enter command like
 =ZÄHLENWENN(B11:B85;"<>0")
or
 =COUNTIF(D11:D85;"<>0")

Result is 75 even if all fields are empty

Actual Results:
75


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: de
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no
Comment 1 Mike Kaganski 2019-03-01 12:09:31 UTC
I'm not quite sure it's a bug.

OpenDocument v.1.2 documentation on COUNTIF (part 2, 6.13.9) [1] refers to 4.11.8 Criterion; and that section tells this:

> Note: "=0" does not match empty cells.

... which might imply that "<>0" does match empty cells as negation of "=0"...
Maybe Eike has a better explanation.

[1] http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#__RefHeading__1018360_715980110
Comment 2 MM 2019-03-01 16:21:24 UTC
On windows 7 x64 with Version: 6.0.7.3 (x64)
Build ID: dc89aa7a9eabfd848af146d5086077aeed2ae4a5
CPU threads: 3; OS: Windows 6.1; UI render: default

the outcome is 0.

On windows 10 with Version: 6.2.1.2 (x64)
Build ID: 7bcb35dc3024a62dea0caee87020152d1ee96e71
CPU threads: 2; OS: Windows 10.0; UI render: default; VCL: win

the outcome = 75.

So what is the correct outcome ?
Comment 3 Oliver Brinzing 2019-03-01 17:40:43 UTC
the implementation changed with LO 6.1.3 fixing issue:

COUNTIF with criterium <>number does not count empty cells.
https://bugs.documentfoundation.org/show_bug.cgi?id=73081
Comment 4 Mike Kaganski 2019-03-01 20:09:42 UTC
So, the reported behavior is correct and consistent with standard -> NOTABUG.

Thanks for your report! A report that turns out not a bug is way better than not reporting what could be a real problem.