Autofil Months based on date range in other cells.

mistatasty

New Member
Joined
Jul 21, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a start and end date for a performance period in cell b5 and b6, respectively. Below that, I would like in row 25 all of the months in that period to auto populate. So if 1/1/20 was entered in cell b5 as the start date and 1/1/21 was entered in cell b6 as the end date, row 25 starting in column e would auto fill the months jan 20, feb 20, mar 20.... all the way to jan 21. Ideally when you expand or contract the end starting or end dates in b5 and b6, row 25 would also add or contract the dates. Any way to do this? Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,647
Office Version
  1. 365
Platform
  1. Windows
If you want a formula you can do this:

=IF(EDATE($B$5,COLUMNS($A$1:A1)-1)<=$C$5,TEXT(EDATE($B$5,COLUMNS($A$1:A1)-1),"mmm yy"),"")

and copy across as far as you are ever likely to need.
 

richh

Board Regular
Joined
Jun 24, 2007
Messages
245
Office Version
  1. 365
  2. 2016
how many months is the maximum you foresee having? If the list is short, say a couple of years, you can use a pretty simple formula.

In E25: =EOMONTH(B5,0)
In F35 - XYZ25: =IF(E25>$C$5,"",EOMONTH(E25,1))

Then, format the field to dislay months and years as desired.
 

mistatasty

New Member
Joined
Jul 21, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows
how many months is the maximum you foresee having? If the list is short, say a couple of years, you can use a pretty simple formula.

In E25: =EOMONTH(B5,0)
In F35 - XYZ25: =IF(E25>$C$5,"",EOMONTH(E25,1))

Then, format the field to dislay months and years as desired.
the maximum would be 36 months.
 

mistatasty

New Member
Joined
Jul 21, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

If you want a formula you can do this:

=IF(EDATE($B$5,COLUMNS($A$1:A1)-1)<=$C$5,TEXT(EDATE($B$5,COLUMNS($A$1:A1)-1),"mmm yy"),"")

and copy across as far as you are ever likely to need.
to clarify, start date is entered in cell b5. end date entered in b6. I need months to populate starting in cell e25 and continue until end date. How does that change the specifications of that formula? Thanks
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,647
Office Version
  1. 365
Platform
  1. Windows
Ok i should read:

=IF(EDATE($B$5,COLUMNS($A$1:A1)-1)<=$B$6,TEXT(EDATE($B$5,COLUMNS($A$1:A1)-1),"mmm yy"),"")
 
Solution
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,194
Messages
5,768,777
Members
425,492
Latest member
blueexcel123

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
Top