Find intermediate months of start and end months of a period

girapas

Board Regular
Joined
Apr 20, 2004
Messages
150
In order to lookup monthly data of a database (in which data are listed by date), for a specific period, a user enters in cells say B2 to B5:
A month from: [..] (as month number, e.g. 9, I've named it Month_From )
The year of month from: [....] (e.g. 2012, I've named it Year_Month_From )
A month to: [..] (e.g. 2, I've named it Month_To )
The year of month to: [....] (e.g. 2013, I've namedit Year_Month_To )

After entering:
In cells K2,K3 I get Month_From and Month_To.
In cells L2,L3 I get Year_Month_From and Year_Month_To.

How can I, automatically, get intermediate months' numbers, in K4 and below (e.g. 10,11,12,1) and corresponding years for each month, in L4 and below (e.g. 2012,2012,2012,2013)?
Thanks in advance.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Maybe...

K4
=IF(DATE($L$3,$L$2,1)>DATE($K$3,$K$2+ROWS($K$4:K4),1),MONTH(DATE($K$3,$K$2+ROWS($K$4:K4),1)),"")
copy down

L4
=IF(DATE($L$3,$L$2,1)>DATE($K$3,$K$2+ROWS($L$4:L4),1),YEAR(DATE($K$3,$K$2+ROWS($K$4:L4),1)),"")
copy down

M.
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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