Skip to content

Circular references and SUMIFS and If functions #1687

Open
@OssianEPPlus

Description

@OssianEPPlus

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions