Bug 159764 - Implement AVERAGE.WEIGHTED Function in LibreOffice Calc
Summary: Implement AVERAGE.WEIGHTED Function in LibreOffice Calc
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2024-02-18 18:02 UTC by ririmello.a
Modified: 2024-04-03 13:58 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
exported ODS from Google Sheets (9.93 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-03-21 11:24 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ririmello.a 2024-02-18 18:02:52 UTC
Description:
I would like to request the implementation of the AVERAGE.WEIGHTED function in LibreOffice Calc, similar to the functionality available in Google Sheets, where it finds the weighted average of a set of values, given the values and the corresponding weights. 

The AVERAGE.WEIGHTED function would provide a convenient way to calculate weighted averages without the need for complex formulas.

Steps to Reproduce:
1.

Actual Results:
 

Expected Results:
 


Reproducible: Always


User Profile Reset: No

Additional Info:
Google Sheets AVERAGE.WEIGHTED function docs:
https://support.google.com/docs/answer/9084098?hl=en&sjid=8153603731442131355-SA#null
Comment 1 Stéphane Guillou (stragu) 2024-03-21 11:23:06 UTC
Thanks for the suggestion.

Workarounds are not cumbersome, but I can see how opening a spreadsheet with the function replaced by the following is not ideal:

=IFERROR(__xludf.dummyfunction("AVERAGE.WEIGHTED(<values>,<weights>)"),<static_result>)

That's what Google Sheets saves it as when exporting to XLSX or ODS.

MS Excel does not seem to support it either, so if we do add it, it does mean that we will be producing files that are less compatible with MS Excel.

Eike, how do we usually proceed when a spreadsheet function is only available in one of the other main office suites? If it's not in ODF -> won't fix?
Comment 2 Stéphane Guillou (stragu) 2024-03-21 11:24:36 UTC
Created attachment 193227 [details]
exported ODS from Google Sheets
Comment 3 Eike Rathke 2024-04-03 13:58:12 UTC
ODF not defining a function doesn't matter, then functions are stored with an extension namespace and we have a bunch of them, see https://wiki.documentfoundation.org/Development/ODF_Implementer_Notes/List_of_LibreOffice_OpenFormula_Extensions

Which of course doesn't help if Google Sheets stores it with their dumb __xludf.dummyfunction() and string argument instead of an ODF standard conformant extension, something like
=IFERROR(COM.GOOGLE.AVERAGE.WEIGHTED(<values>,<weights>),<static_result>)