ExcelFinancialFunctions 3.1.0-rc2

This is a prerelease version of ExcelFinancialFunctions.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ExcelFinancialFunctions --version 3.1.0-rc2                
NuGet\Install-Package ExcelFinancialFunctions -Version 3.1.0-rc2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExcelFinancialFunctions" Version="3.1.0-rc2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExcelFinancialFunctions --version 3.1.0-rc2                
#r "nuget: ExcelFinancialFunctions, 3.1.0-rc2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ExcelFinancialFunctions as a Cake Addin
#addin nuget:?package=ExcelFinancialFunctions&version=3.1.0-rc2&prerelease

// Install ExcelFinancialFunctions as a Cake Tool
#tool nuget:?package=ExcelFinancialFunctions&version=3.1.0-rc2&prerelease                

Excel Financial Functions

This is a .NET Standard library that provides the full set of financial functions from Excel. The main goal for the library is compatibility with Excel, by providing the same functions, with the same behaviour. Note though that this is not a wrapper over the Excel library; the functions have been re-implemented in managed code so that you do not need to have Excel installed to use this library.

NuGet Badge Build+Test+Docs

Goal: Match Excel

We replicate the results Excel would produce in every situation, even in cases where we might disagree with Excel's approach. Please have a look at the Compatibility page for more detail on this topic.

Microsoft's official documentation on Excel Functions is the best place to learn more about how the functions should work. The scope for this library is the full set of functions in the "Financial Functions" category.

Thoroughly tested

As of last count, the library is validated against 199,252 test cases.

  • ExcelFinancialFunctions.Tests: Unit tests checking against previously-determined truth values from Excel 2010. Inputs and expected outputs are read from data files.
  • ExcelFinancialFunctions.ConsoleTests: Test cases comparing the library results directly to running Excel code via interop. These should be run on a Windows machine with Excel 2013 (or later) installed.

You can help!

Found a discrepency? Open an Issue! Or better yet, a Pull Request.

Adding it to your project

Excel Financial Functions is a .NET Standard 2.0 library, which you can add to any project based on a .NET implementation which supports the standard. This includes .NET Framework 4.6.1 or later, and .NET Core 2.0 or later.

Simply add it from NuGet in the usual way:

PS> dotnet add package ExcelFinancialFunctions

  Determining projects to restore...
info : Adding PackageReference for package 'ExcelFinancialFunctions' into project 
info :   GET https://api.nuget.org/v3/registration5-gz-semver2/excelfinancialfunctions/index.json
info :   OK https://api.nuget.org/v3/registration5-gz-semver2/excelfinancialfunctions/index.json 69ms
info : Restoring packages for project.csproj...
info : PackageReference for package 'ExcelFinancialFunctions' version '2.4.1' added to file 'project.csproj'.
info : Committing restore...
log  : Restored project.csproj (in 72 ms).

Using it

Even though the libary is written in F#, you can use it from any .NET language, including C#. The functions are provided as static methods on a Financial class in the Excel.FinancialFunctions namespace.

using Excel.FinancialFunctions;

Console.WriteLine( Financial.IPmt(rate: 0.005, per: 53, nper: 180, pv: 200000, fv: 0, typ: PaymentDue.EndOfPeriod) );
// Displays -796.3747578439793

Console.WriteLine( Financial.Pmt(rate: 0.005, nper: 180, pv: 200000, fv: 0, typ: PaymentDue.EndOfPeriod) );
// Displays -1687.7136560969248

Or from F#:

open Excel.FinancialFunctions

printfn "%f" <| Financial.IPmt (0.005, 53., 180., 200000., 0., PaymentDue.EndOfPeriod) 
// Displays -796.374758

printfn "%f" <| Financial.Pmt (0.005, 180., 200000., 0., PaymentDue.EndOfPeriod) 
// Displays -1687.713656
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ExcelFinancialFunctions:

Package Downloads
dexih.functions.financial

Data transformation and Anaytics library - Financial Functions

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.3.0-rc1 30,837 7/30/2022
3.2.0 879,796 5/11/2022
3.1.0 113,683 12/20/2021
3.1.0-rc2 992 12/20/2021
3.0.0 9,205 12/7/2021
3.0.0-rc2 1,098 12/7/2021
3.0.0-rc1 1,035 12/6/2021
2.4.1 217,614 10/22/2019
2.4.0 249,924 9/5/2016
2.3.1 11,312 3/11/2016
2.3.0 15,445 3/9/2016
2.2.0 11,607 3/25/2014
2.1.0 3,467 1/18/2014

- Adds PDURATION function. Returns the number of periods required by an investment to reach a specified value. (Resolves #62)
- Adds RRI function. Also used for CAGR. Returns an equivalent interest rate for the growth of an investment. (Resolves #60)
- Improves XIRR function by reducing the precision required before an answer is returned. (Fixes #27)
- Improves ACCRINT function by allowing first interest date on the settlement date. (Fixes #22)
- Adds PriceAllowNegativeYield function. This operates like the PRICE function except that it allows negative yield inputs. It is experimental. We'd love feedback on how this works for folks. (Fixes #13)