LesterLyu/fast-formula-parser

How to handle formula with dependent arguments containing formula?

charanjit-singh opened this issue · 3 comments

For example how to handle formula SUM(A1,B2) if A1 is also =B4-B3?

@charanjit-singh this would result in two calculations.

I am assuming that this is not a cyclical dependency.

The way to solve this is to resolve these in dependency order (a topological sort can do this in a generalized way see https://en.wikipedia.org/wiki/Dependency_graph and https://en.wikipedia.org/wiki/Topological_sorting). By sorting all calced values in a 'shared map' you can then return the calculated value via the onCell method

Thanks @michaeltford ,

Do you have any example?

@charanjit-singh Not at the moment but I am considering building one in the near future.