Share 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