UDF to Calculate the Month

bradh_nz

Board Regular
Joined
May 23, 2006
Messages
92
Hi

I am after a UDF to calculate the month based on a a date. I cannot use the month function in excel as the dates are slighlty different.

ie

05/01/07 - 06/02/07 = Jan
06/02/07 - 05/03/07 = Feb

Any help appreciated

Thanks
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Based on that, it looks like it changes every year and there isn't anything consistent about it. I would make a LOOKUP table which you would then just change once a year. The first column is the low end of each range. The second column is just a date using the first of each month to represent the corresponding month/year.

Formula in B1:
=LOOKUP(A1,$J$1:$K$12)

Format this cell as mmmm yyyy
Book3
ABCDEFGHIJK
105/03/2007March 200705/03/200701/03/2007
211/04/200701/04/2007
309/05/200701/05/2007
408/06/200701/06/2007
507/07/200701/07/2007
608/08/200701/08/2007
708/09/200701/09/2007
806/10/200701/10/2007
908/11/200701/11/2007
1008/12/200701/12/2007
1109/01/200801/01/2008
1208/02/200801/02/2008
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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