# Autofil Months based on date range in other cells.

#### mistatasty

##### New Member
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
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
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
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

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
Put the formula in E25. Drag it to right.

#### mistatasty

##### New Member

Put the formula in E25. Drag it to right.
formula is showing as a blank cell, not sure why?

#### steve the fish

##### Well-known Member

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

#### mistatasty

##### New Member

=IF(EDATE(\$B\$5,COLUMNS(\$A\$1:A1)-1)<=\$B\$6,TEXT(EDATE(\$B\$5,COLUMNS(\$A\$1:A1)-1),"mmm yy"),"")
Thank you!

Replies
7
Views
56
Replies
6
Views
131
Replies
3
Views
147
Replies
2
Views
160
Replies
5
Views
32

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.

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.

### Which adblocker are you using?

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

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