Generate series of months by Formula

Please see attached file.  

I need help with a formula where when i put it in cell B2 and drag down and right. it will generate the YYYYMM dates for me as it is shown in the cells highlighted in yellow.

any help is appreciated.
Who is Participating?
Ejgil HedegaardConnect With a Mentor Commented:
Try this.
Formula in B2.

Open in new window

If the row above is text, then the YearMonth is made from the first date in the text.
If not it is made by finding the next month from the row above, and format to YearMonth.
NorieVBA ExpertCommented:

So you will have date ranges in row 2 starting in column B and you want a formula to generate the months/years for those ranges in the rows below?
FloraAuthor Commented:
yes Norie.

my date range will be in Row 1 and then the yellow cells are the one that formula should generate.

thanks alot
FloraAuthor Commented:
This is extra-ordinary perfect solution. exactly what i was looking for. thanks a million Ejgil.  very much appreciated.
Rob HensonFinance AnalystCommented:
I realise you have already accepted Ejgil's excellent solution but here is another option.

Do your values have to be text or can they be true dates but formatted just to show as "YYYYMM"?

If true dates are OK then:


This can be copied down as many rows as you like rather than the specific number of rows for the range of dates; I assume the most that you would need would be 12, ie all 12 months of a year.

Then apply a custom format to the cells of "yyyymm"  (without the quotes).

See Sheet2 of attached file; I have also used Conditional Formatting on all 12 rows to highlight those with dates.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.