ByteScout Spreadsheet SDK - C# - Calculate XIRR Function - ByteScout

ByteScout Spreadsheet SDK – C# – Calculate XIRR Function

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – C# – Calculate XIRR Function

How to calculate XIRR function in C# using ByteScout Spreadsheet SDK

This tutorial will show how to calculate XIRR function in C#

With this source code sample you may quickly learn how to calculate XIRR function in C#. ByteScout Spreadsheet SDK: the library (SDK) that is capable of writing, reading, modifying and calculating Excel and CSV spreadsheets. Most popular formulas can be calculated and reculculated with Excel installed. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can calculate XIRR function in C#.

This rich sample source code in C# for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to calculate XIRR function. In your C# project or application you may simply copy & paste the code and then run your app! Implementing C# application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Trial version of ByteScout Spreadsheet SDK is available for free. Source code samples are included to help you with your C# app.

Try ByteScout Spreadsheet SDK today: Get 60 Day Free Trial or sign up for Web API

Program.cs
      
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using Bytescout.Spreadsheet; namespace CSharp { class Program { static void Main(string[] args) { // Create new Spreadsheet Spreadsheet document = new Spreadsheet(); // Set locale document.Workbook.Locale = new System.Globalization.CultureInfo("en-US"); // Add new worksheet Worksheet worksheet = document.Workbook.Worksheets.Add(); // Fill some data worksheet.Cell(1, 1).Value = new DateTime(2008, 01, 01); worksheet.Cell(1, 2).Value = 100; worksheet.Cell(2, 1).Value = new DateTime(2009, 01, 01); worksheet.Cell(2, 2).Value = -200; // Apply function worksheet.Cell(4, 1).Formula = "=XIRR(C2:C3,B2:B3,0)"; // Read value worksheet.Cell(4, 2).Value = worksheet.Cell(4, 1).Value; // delete output file if exists already if (File.Exists("Output.xls")) { File.Delete("Output.xls"); } // Save document document.SaveAs("Output.xls"); // Close Spreadsheet document.Close(); // open generated XLS document in default program Process.Start("Output.xls"); } } }

Try ByteScout Spreadsheet SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout Spreadsheet SDK page

Explore ByteScout Spreadsheet SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next