Dynamic Date Column Headers

jbfrank

Active Member
Joined
Oct 13, 2003
Messages
290
I'm trying to build a financial report that automatically pulls in data based on a date range...but the date range can change. For simplicity, let's just use 'years'. Here's what I have:

A1: 2019 (this is the starting year)
A2: 5 (this is the number of incremental years I'd like to view)

Desired result:

Starting in A5, I'd like to have '2019' with each consecutive year showing up in B5, C5, D5 and E5. Easy enough.

I'm struggling to make this range dynamic. So, if I have 7 incremental years I'd like to view, then I'd like to have those show up in B5:G5.

I'm open to other (and probably better) options on doing this as well.

Really appreciate the help!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Copy across to cover the max number of years you could want.


Book1
ABCDEF
12019
25
3
4
520192020202120222023 
Sheet1
Cell Formulas
RangeFormula
A5=A1
B5=IF(COLUMNS($A$5:B5)<=$A$2,A5+1,"")
C5=IF(COLUMNS($A$5:C5)<=$A$2,B5+1,"")
D5=IF(COLUMNS($A$5:D5)<=$A$2,C5+1,"")
E5=IF(COLUMNS($A$5:E5)<=$A$2,D5+1,"")
F5=IF(COLUMNS($A$5:F5)<=$A$2,E5+1,"")
 
Upvote 0

Forum statistics

Threads
1,215,002
Messages
6,122,652
Members
449,092
Latest member
peppernaut

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