Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Functions do not take null named expressions into account #1389

Open
jboysen opened this issue Mar 7, 2024 · 2 comments · May be fixed by #1390
Open

[Bug]: Functions do not take null named expressions into account #1389

jboysen opened this issue Mar 7, 2024 · 2 comments · May be fixed by #1390
Labels
Bug Something isn't working Impact: Medium

Comments

@jboysen
Copy link

jboysen commented Mar 7, 2024

Description

We have found a deviation from Excel where named expressions not set are taken into account in functions. E.g. for the following code:

hf.addNamedExpression("a", "=1");
hf.addNamedExpression("b", "=1");
hf.addNamedExpression("d", null);
hf.addNamedExpression("e", "=AVERAGE(a,b,c)");
// e yields 0.666666666666667, but should yield 1

In Excel the corresponding example correctly yields 1: Hyperformula function issue.xlsx

This causes some issues, as it either requires that users of Hyperformula always define all required named expressions or they take this into account in formulas, which will give very long formulas.

Video or screenshots

No response

Demo

https://jsfiddle.net/9muhqwct/3/

HyperFormula version

2.6.2

Your framework

No response

Your environment

Chrome 122 on Windows 11

@sequba
Copy link
Contributor

sequba commented Mar 7, 2024

Hi @jboysen! Thank you for reaching out to us. This behavior doesn't seem correct. We will fix it in one of the upcoming releases.

It seems that there is an issue with the implementation of the function AVERAGE. The non-numeric arguments passed as cell references or raw values are ignored (following the definition of AVERAGE). Named expression arguments, however, are coerced to number instead.

Other functions from NumericAggregationPlugin may also be affected by this issue.

@sequba sequba added Bug Something isn't working Impact: Medium labels Mar 7, 2024
@sequba sequba linked a pull request Mar 7, 2024 that will close this issue
13 tasks
@jboysen
Copy link
Author

jboysen commented Mar 7, 2024

Hi @sequba, Thanks a lot, sounds nice. Looking forward to the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Impact: Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants