Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - Evaluate Excel Logical Formulas

Tags:

c#

.net

excel

I have an Application that need to evaluate Excel Logical Formulas and I use Excel DLL to do this, but DLL isn't it very efficient.

.NET Framework (C#) has any Class that can make this Job?

An sample

I Provide this

=IF(AND(10>=-5;10<0);(-3,8*10+335);IF(AND(10>=0;10<5);(1,4*10+335);IF(AND(10>=5;10<14,4);(-1,2766*10+348,38);IF(AND(10>=14,4;10<25);(-1,5094*10+351,74);IF(AND(10>=25;10<=45);(-1,4*10+349);0)))))

And get this

335,614

Thanks

like image 390
Guilherme Ferreira Avatar asked Jan 12 '10 13:01

Guilherme Ferreira


1 Answers

Yes, agreed, the Excel.Application.Evaluate method can be slow. It usually suits my needs, but it's not lightening fast.

I think the best source for evaluating Excel formulas without the Excel object mode is:

  • Excel Formula Parsing, in C#

Some other related articles:

Hope this helps...

like image 172
Mike Rosenblum Avatar answered Sep 29 '22 08:09

Mike Rosenblum