Bond Cashflow Dates

felixschreibt

New Member
Joined
Jun 21, 2024
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

I m looking for a code or formula that could estimate bond cash flow dates based on maturity date.

Mat Date = 29/03/2033
Start Date = 21/06/2024

Cashflow Frequency = 1 (annual)

Output: 29/03/2033, 29/03/2032...[...]...29/03/2025

Output varies with CF frequency (i.e. semiannally) and start date.

Any chance to get that into VBA?
Thx
F
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Maturity ", type date}, {"Start", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Generate(()=>[x=#date(2024,6,29),i=0], each [i]<105, each [i=[i]+1,x=Date.AddMonths([x],1)], each [x])),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Nr Months", Int64.Type}}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Changed Type1", "Custom")
in
    #"Expanded Custom"
 
Upvote 0
Im actually looking for a vba code, sth like this:

Sub cashflows()

Dim start As Date
Dim maturitiy As Date
Dim num_cf As Integer

start = Cells(2, 1).Value
maturity = Cells(2, 2).Value
num_cf = DateDiff("yyyy", start, maturity)
Cells(2, 3) = num_cf

For i = 1 To num_cf
Cells(2, 3 + i) = DateAdd("yyyy", -1, maturity)

Next i

End Sub
 
Upvote 0
Im actually looking for a vba code, sth like this:

Sub cashflows()

Dim start As Date
Dim maturitiy As Date
Dim num_cf As Integer

start = Cells(2, 1).Value
maturity = Cells(2, 2).Value
num_cf = DateDiff("yyyy", start, maturity)
Cells(2, 3) = num_cf

For i = 1 To num_cf
Cells(2, 3 + i) = DateAdd("yyyy", -1, maturity)

Next i

End Sub
Problem here is that I dont know how to also construct the cashflow date. The code writes maturity date - 1 year in all cells. So I need a second loop or function for maturity date after the first loop has ended.
 
Upvote 0
Problem here is that I dont know how to also construct the cashflow date. The code writes maturity date - 1 year in all cells. So I need a second loop or function for maturity date after the first loop has ended.
I think I almost got it - what I dont get is why is Excel posting 01.06.1900 in cells (2,3) which has nothing to do with the mat or start date. In my example num_cf is 6. Any idea?

Sub cashflows()

Dim start As Date
Dim maturitiy As Date
Dim num_cf As Integer

start = Cells(2, 1).Value
maturity = Cells(2, 2).Value
num_cf = DateDiff("yyyy", start, maturity)
Cells(2, 3) = num_cf

For i = 1 To num_cf
Cells(2, 3 + i) = DateAdd("yyyy", -num_cf + i, maturity)
Next i

End Sub
 
Upvote 0
I think I almost got it - what I dont get is why is Excel posting 01.06.1900 in cells (2,3) which has nothing to do with the mat or start date. In my example num_cf is 6. Any idea?

Sub cashflows()

Dim start As Date
Dim maturitiy As Date
Dim num_cf As Integer

start = Cells(2, 1).Value
maturity = Cells(2, 2).Value
num_cf = DateDiff("yyyy", start, maturity)
Cells(2, 3) = num_cf

For i = 1 To num_cf
Cells(2, 3 + i) = DateAdd("yyyy", -num_cf + i, maturity)
Next i

End Sub
also clear, its the num_cf which excel was showing me as date :)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top