Skip to main content

A .NET Standard library that provides the full set of financial functions from Excel.

Total Downloads
4.0M
4,015,238
Published
May 11, 2022
4y ago

Get Started

dotnet add package ExcelFinancialFunctions --version 3.2.0
ProductVersions
.NET Standard
netstandard2.0

README

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

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.