IRONSOFTWAREHOME
Excel Formulas in C#
from ironxl import *

# Load the Excel workbook
workbook = WorkBook.Load("sample.xlsx")
worksheet = workbook.DefaultWorkSheet

# Set Formulas
worksheet["A1"].Formula = "Sum(B8:C12)"
worksheet["B8"].Formula = "=C9/C11"
worksheet["G30"].Formula = "Max(C3:C7)"

# Force recalculate all formula values in all sheets.
workbook.EvaluateAll()

# Get the formula's calculated value. e.g. "52"
formula_value = worksheet["G30"].ToArray()[0].FormattedCellValue

# Get the formula as a string. e.g. "Max(C3:C7)"
formula_string = worksheet["G30"].Formula

# Save changes with updated formulas and calculated values.
workbook.Save()
pip install ironxl
Excel Formulas in C#

Excel Formulas in C#

Using IronXL to Work with Excel Formulas in Python

IronXL for Python allows setting and evaluating Excel formulas without the need for Office Interop or a licensed Excel installation. It supports over 150+ formulas, with more being added regularly. Formulas are assigned using the Range.Formula property.

A formula is an expression used to calculate the value of a cell. In Excel, functions are predefined formulas that are always available for use.

IronXL distinguishes itself among Python Excel libraries by supporting a wide range of built-in Excel formulas and enabling their real-time calculation in Python applications.

How to Use Excel Formulas in Python

Here are the steps to work with Excel formulas using IronXL in a Python project:

  1. Install IronXL for Python: Install IronXL via pip to access Excel functionality.
  2. Load the Excel Document: Open your Excel file and select the WorkSheet where you want to apply formulas.
  3. Set Formulas and Values: Assign formula strings and any required values to the target cells.
  4. Evaluate Formulas: Use the EvaluateAll method to compute the results of all applied formulas.
  5. Save the WorkBook: Save the WorkBook back to an Excel file, reflecting all changes and calculations.

IronXL provides a straightforward and efficient method for working with Excel formulas programmatically in Python, without requiring Excel to be installed on the server or client machine.

Learn to Edit Excel Formulas in Python with IronXL

Ready to Get Started?

Version:2026.10just released

Key in blue circle

Get your free 30-day Trial Key instantly

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronXL for Python
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
Get your free 30-day Trial Key instantly.
No credit card or account creation required
Python Module Download for Excel
Install with pip

Version: 2026.10

  1. Download and install Python 3.7+.
  2. Install pip from pypi.org if it isn't installed already.
  3. Execute the above command in the terminal.
Python PDF Module
Download Module

Version: 2026.10

Manually install into your project

  1. Download the package
  2. Run this command from the terminal
    pip install IronXL-2026.10-py37-none-win_amd64.whi

Licenses from $999