How to Price a Swap in Excel Using BlueGamma's Add-in
Price an interest rate swap directly in Excel using BlueGamma's Excel Add-in. Build a cashflow schedule with forward rates and discount factors to calculate the mid swap rate.
This guide walks you through pricing a vanilla interest rate swap in Excel using BlueGamma functions. You'll build a cashflow schedule with forward rates and discount factors, then calculate the mid swap rate using a weighted average approach.
This example uses a 10-year SOFR swap with semi-annual payments and an amortizing notional.
Before You Start
To follow this guide, make sure you have:
Installed the BlueGamma Excel Add-in
Signed in through the BlueGamma tab in Excel
Excel Add-in activated (contact [email protected] to activate)
If you haven't set this up yet, see:
Installation & SetupOverview: How Swap Pricing Works
A swap's mid rate is the fixed rate that makes the present value of the fixed leg equal to the present value of the floating leg — i.e., NPV = 0.
The formula-based approach calculates this as a weighted average of forward rates, where the weights are the discount factors × day count fractions × notionals.
Where:
Fi = Forward rate for period i
DFi = Discount factor to payment date i
τi = Day count fraction for period i
Ni = Notional for period i
1. Set Up Your Parameters
Start by defining your swap parameters in fixed cells:

B1
Index
SOFR
B2
Start Date
2025-12-15
B3
Maturity
2035-12-15
B4
Payment Freq
6M
B5
Valuation Date
(leave blank for live, or enter a date)
2. Build the Cashflow Schedule
Create your schedule starting in row 6 with headers, and data beginning in row 7:
A
Period
Payment period number (1, 2, 3, ...)
B
Start Date
Beginning of interest accrual period
C
End Date
End of interest accrual period (payment date)
D
Notional
Outstanding notional for this period
E
Day Count Frac
Days in period / 360 (or appropriate convention)
F
Forward Rate
Forward rate from BlueGamma
G
Discount Factor
Discount factor to end date from BlueGamma
H
Floating PV
Present value of floating cashflow
I
Fixed Weight
Weight for fixed rate calculation

3. Enter Start and End Dates
For a 10-year semi-annual swap starting 15-Dec-2025:
1
2025-12-15
2026-06-15
2
2026-06-15
2026-12-15
3
2026-12-15
2027-06-15
...
...
...
20
2035-06-15
2035-12-15
Tip: Use =EDATE(B7, 6) to generate semi-annual dates, then copy down.
4. Enter the Amortizing Notional
For this example, we'll use a linear amortization from 100,000,000 to 0 over 10 years:
1
100,000,000
2
95,000,000
3
90,000,000
...
...
20
5,000,000
Enter your actual notional schedule based on your debt amortization
5. Calculate Day Count Fractions
For ACT/360 convention (standard for SOFR), in cell E7:
This gives you the fraction of a year for each period. Copy down for all periods.
6. Pull Forward Rates
Use the BlueGamma function to fetch forward rates for each period. In cell F7:
Where:
$B$1= Your index (SOFR)B7= Start date of the periodC7= End date of the period

Copy this formula down for all periods.
7. Pull Discount Factors
Use the BlueGamma function to fetch discount factors to each payment date. In cell G7:
Where:
$B$1= Your index (SOFR)C7= End date (payment date)

Copy this formula down for all periods.
8. Calculate Floating Leg Present Value
For each period, calculate the present value of the floating cashflow. In cell H7:
Where:
D7 = Notional
E7 = Day Count Fraction
F7 = Forward Rate
G7 = Discount Factor
This gives: Notional × DCF × Forward Rate × Discount Factor
Copy this formula down for all periods.
9. Calculate Fixed Leg Weights
The weight for each period in the fixed rate calculation. In cell I7:
Where:
D7 = Notional
E7 = Day Count Fraction
G7 = Discount Factor
This gives: Notional × DCF × Discount Factor

Copy this formula down for all periods.
10. Calculate the Mid Swap Rate
The mid swap rate is the weighted average of forward rates:
Where:
H7:H26 = Sum of all Floating PV values (20 periods)
I7:I26 = Sum of all Fixed Weights (20 periods)

This is your mid swap rate!
11. Verify: NPV Should Equal Zero
To verify your calculation, compute the NPV:
Fixed Leg PV:

Floating Leg PV:
NPV = Fixed Leg PV - Floating Leg PV
If your mid swap rate is correct, NPV should be zero (or very close to zero due to rounding).
Complete Formula Reference
E
=(C7-B7)/360
Day Count Fraction
F
=BlueGamma.FORWARD_RATE($B$1, B7, C7)
Forward Rate
G
=BlueGamma.DISCOUNT_FACTOR($B$1, C7)
Discount Factor
H
=D7*E7*F7*G7
Floating PV
I
=D7*E7*G7
Fixed Weight
Mid Swap Rate: =SUM(H7:H26)/SUM(I7:I26)
Example: Complete Swap Pricing Spreadsheet
Here's a complete working example showing a 10-year SOFR amortizing swap priced using BlueGamma functions:

The formula bar shows how the BlueGamma.FORWARD_RATE function is used to pull forward rates directly into Excel:

Tips for Financial Models
Lock the index reference using
$B$1so it doesn't change when copying formulas.Use a valuation date for historical pricing or model runs:
Validate against BlueGamma web app — compare your calculated rate with the Swap Pricer at app.bluegamma.io.
Handle date conventions — ensure your dates match your actual swap terms (modified following, etc.).
Troubleshooting
#VALUE! errors
Check date formats are valid (YYYY-MM-DD or Excel dates)
Rate seems wrong
Verify the index name matches exactly (e.g., "SOFR" not "sofr")
Discount factors > 1
Check your dates aren't in the past
NPV not zero
Ensure all periods are included in your sums
Need help getting started?
📩 [email protected] | 📅 Book a call
Last updated
Was this helpful?

