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

Circular references and SUMIFS and If functions #1687

Open
OssianEPPlus opened this issue Nov 14, 2024 · 1 comment
Open

Circular references and SUMIFS and If functions #1687

OssianEPPlus opened this issue Nov 14, 2024 · 1 comment
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@OssianEPPlus
Copy link
Contributor

OssianEPPlus commented Nov 14, 2024

Excel works with some functions Epplus considers circular.

For example a SUMIF function in Excel is only considered circular if the cell is actually relevant to the calculation.
While Epplus throws as soon as it COULD become circular.

Consider for example:

Screenshot 2024-11-14 131310

Excel evaluates this to 44 (D2 = 10 + D4 = 34) while Epplus throws an exception when evaluating the very first argument. (Since cell D5 is within the range D2:D9.)

This seems to be because Excel checks the IF first. Or in this case, checks if row 5 has a 'mats' value. If it does there's a circular reference. Otherwise it works.

As such If you change the value from Jan to Mats on row 5 Excel ALSO counts it as a circular reference.

Arguably we should evaluate potential IF calculations before checking the range address to see if the actually relevant cells (D2,D4) are circular references.
That said a formula that has the risk to become a circular reference like this is likely to cause problems eventually anyway.

@OssianEPPlus
Copy link
Contributor Author

This can be used as a test workbook
s761CircularReferenceWb.xlsx

@OssianEPPlus OssianEPPlus added bug Something isn't working enhancement New feature or request labels Nov 14, 2024
JanKallman added a commit that referenced this issue Nov 20, 2024
@OssianEPPlus OssianEPPlus added this to the EPPlus 8.0 milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant