<p>I have a set of calculation methods sitting in a .Net DLL.  I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets.</p>

<p>For example, my .net method:</p>

<pre><code>public double CalculateSomethingReallyComplex(double a, double b) {...}
</code></pre>

<p>I would like enable them to call this method just by typing a formula in a random cell:</p>

<pre><code>=CalculateSomethingReallyComplex(A1, B1)
</code></pre>

<p>What would be the best way to accomplish this?</p>

[{'answer_id': 54429, 'author': 'samjudson', 'author_id': 1908, 'author_profile': 'https://Stackoverflow.com/users/1908', 'pm_score': 3, 'selected': True, 'text': '<p>There are two methods - you can used Visual Studio Tools for Office (VSTO):</p>\n\n<p><a href="http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/pstubbs/archive/2004/12/31/344964.aspx</a></p>\n\n<p>or you can use COM:</p>\n\n<p><a href="http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx</a></p>\n\n<p>I\'m not sure if the VSTO method would work in older versions of Excel, but the COM method should work fine.</p>\n'}, {'answer_id': 428190, 'author': 'Govert', 'author_id': 44264, 'author_profile': 'https://Stackoverflow.com/users/44264', 'pm_score': 3, 'selected': False, 'text': '<p>You should also have a look at ExcelDna (<a href="http://www.codeplex.com/exceldna" rel="noreferrer">http://www.codeplex.com/exceldna</a>). ExcelDna is an open-source project (also free for commercial use) that allows you to create native .xll add-ins using .Net. Both user-defined functions (UDFs) and macros can be created. Your add-in code can be in text-based script files containing VB, C# or F# code, or in managed .dlls.</p>\n\n<p>Since the native Excel SDK interfaces are used, rather than COM-based automation, add-ins based on ExcelDna can be easily deployed and require no registration. ExcelDna supports Excel versions from Excel \'97 to Excel 2007, and includes support for the Excel 2007 data types (large sheet and Unicode strings), as well as multi-threaded recalculation under Excel 2007.</p>\n'}]
['https://Stackoverflow.com/questions/54387', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1324220/']