Bug 89994 - Wrong result of calculation for statistical function Mean in Writer tables
Summary: Wrong result of calculation for statistical function Mean in Writer tables
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Writer-Tables-Formulas
  Show dependency treegraph
Reported: 2015-03-13 16:21 UTC by kern_monika
Modified: 2020-11-14 09:29 UTC (History)
1 user (show)

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

Example file (8.69 KB, application/odt)
2017-04-20 18:50 UTC, Telesto

Note You need to log in before you can comment on or make changes to this bug.
Description kern_monika 2015-03-13 16:21:59 UTC
the formula statistic - mean value in a table does not compute the correct value.
It computes sum(over x columns) / x columns
instead of dividing by the columns that have a value.


5 columns:
values: 2 empty 1 empty 3

the mean value should be (2+1+3)/3 = 2
LO writer computes (2+1+3)/5 = 1,2
Comment 1 A (Andy) 2015-03-13 18:27:10 UTC
Reproducible with LO, Win 8.1

On the other hand CALC computes it correctly = 2.
Comment 2 tommy27 2016-04-16 07:25:24 UTC Comment hidden (obsolete)
Comment 3 Telesto 2017-04-20 18:50:02 UTC
Confirming with:
CPU threads: 4; OS: Windows 6.19; UI render: GL; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-04-05_23:32:27
Locale: nl-NL (nl_NL); Calc: CL

and with:
Versie (Bouw-id: 7545bee9c2a0782548772a21bc84a9dcc583b89)
Comment 4 Telesto 2017-04-20 18:50:20 UTC
Created attachment 132723 [details]
Example file
Comment 5 QA Administrators 2018-04-21 02:33:55 UTC Comment hidden (obsolete)
Comment 6 Roman Kuznetsov 2019-01-16 13:43:54 UTC
still repro in

Build ID: 6b4ea2d8ddd681fec98773d7e0bbec9657a1fc08
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 7 Mike Kaganski 2020-11-14 09:29:40 UTC
This is not a bug.

Writer's formulas are using the old Writer formula engine, totally unrelated to Calc. And in it, every cell used in the MEAN is counted, with a cell not having a value counted as zero.

(In reply to A (Andy) from comment #1)
> On the other hand CALC computes it correctly = 2.

Computes what? "MEAN"? There's no such function in Calc. Calc's AVERAGE is a different function.

Changing the definition of MEAN to mean something different would break documents where it's currently used, where its current behavior is wanted.

Of course, making it possible to use Calc formulas (something that is possible with ODF standard, by specifying which namespace is used for the formulas internally) would make lives much better - but that's a separate problem.

Closing NOTABUG.