Partilhar via


Fsharp & Excel: Calling Excel Math Functions From F# FSI

Technorati Tags: F#,Fsharp,FSI,Excel,VS2010

While I am working on compiling a list of .Net math libraries, I found a simple way to call Excel math library from F# FSI. In the following example, I will show how to use Excel’s Median, StDev and MInverse functions from F# scripting environment (FSI).

image

Software setup: VS2010 Sp1 with Office 2010 installed.

There are few benefits of using Excel math libraries:

  • Correctness: you can almost certain the correctness of the excel math functions.
  • Popularities: most the financial excel guru knows one thing or another about the excel math functions. This allow them to pickup these familiar functions very quickly.
  • IDE support: Basic intellisense support is very important for the user. Just a little bit of UI hit can void breaking user’s code flow experience.

image

but, there are also issues:

  • Debugging: When the math function is not working, debugging them is troublesome. you may get a comException gives no clue about the problem. A good way to debug these issues is to start with a small dataset, try it out inside the excel first.

image

Both F# and C# Code example @ https://code.msdn.microsoft.com/Calling-Excel-Math-6b811836

Happy Coding!

-jack

Comments

  • Anonymous
    April 05, 2011
    Cool. Thanks. Please post more on F#+Excel or direct me to useful links.

  • Anonymous
    April 06, 2011
    Thank you, more post on Excel topic will follow

  • Anonymous
    April 06, 2011
    Thanks a lot. Might be usefull one day. Looking foreward to the list of math libraries.