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

Technorati Tags: ,,,,

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).


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.


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.


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

Happy Coding!


Comments (3)

  1. jliettehk says:

    Cool. Thanks. Please post more on F#+Excel or direct me to useful links.

  2. Jack hu says:

    Thank you, more post on Excel topic will follow

  3. Peter says:

    Thanks a lot. Might be usefull one day.

    Looking foreward to the list of math libraries.