Bug 140672 - Undefined values (empty cell) being treated as zero in table formulas
Summary: Undefined values (empty cell) being treated as zero in table formulas
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Tables-Formulas
  Show dependency treegraph
 
Reported: 2021-02-25 21:53 UTC by Ulrich Windl
Modified: 2022-04-26 11:13 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Screenshot showing a table with undefined cells (using min, man, and mean) (9.46 KB, image/png)
2021-02-25 21:53 UTC, Ulrich Windl
Details
Example Document (24.28 KB, application/vnd.oasis.opendocument.text)
2021-05-16 18:49 UTC, Ulrich Windl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Windl 2021-02-25 21:53:45 UTC
Created attachment 170065 [details]
Screenshot showing a table with undefined cells (using min, man, and mean)

As opposed to Calc, Writer treats missing cell data as zero.
That makes it hard to use functions like min, max or mean (the min will mostly be zero for positive values, max will be zero for negative values, and the mean will typically be too small.
See attached screen shot for a real-life example (measurement data when not all measurements were made).
Comment 1 himajin100000 2021-03-05 13:46:52 UTC
FWIW:

In current implementation, the only functions that ignore the empty cells are "AVERAGE","COUNT", and "PRODUCT". 
(i.e. When I create a 1-row and 3-column table, and input 1 to A1, =AVERAGE(<A1:B1>) to C1 and keep the B1 cell empty, the avearge value will be 1, not (1 + 0) /2 = 0.5)

https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/cellfml.cxx?r=94306083&fi=MakeFormula_#360

https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/cellfml.cxx?r=94306083&fi=MakeFormula_#376
Comment 2 Xisco Faulí 2021-05-10 16:15:03 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Comment 3 Ulrich Windl 2021-05-16 18:49:44 UTC
Created attachment 172069 [details]
Example Document

This example document should match the screenshot.
Comment 4 Buovjaga 2022-04-26 11:13:45 UTC
I confirm

Arch Linux 64-bit
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 37613bffe4621c444e5a34678bafb2c3a875263d
CPU threads: 8; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded Jumbo
Built on 26 April 2022