MrExcel Publishing
Your One Stop for Excel Tips & Solutions


Posted by Zoe Reyes on January 24, 2002 8:23 AM

I'm pretty "green" in Excel as you are about to find out, and would appreciate any assistance in solving the following:

I'm working on a spredsheet that has fiscal years in a row as text as follows: "FY02", FY03", etc., and in another row, months as follows: "JUL HRS", "SEP HRS", and so on.

I need to be able to return the last day of the month for each month, for instance, FY02 - JULHRS => Jul-31-2002.

Any advice on how to go about it will be kindly appreciated.



Posted by Aladin Akyurek on January 24, 2002 8:46 AM


where A2 houses strings like FY 02 and B2 strings like JUL HRS.

Custom format the cell of this formula as:



Posted by Steve Hartman on January 24, 2002 9:01 AM

Assuming FY02 is in A1 and JUL HRS is in A3:


Adjust cell references as needed for the other months and years.

Posted by Dan Aragon on January 24, 2002 9:36 AM

This is what I would do. In a spot on your worksheet that you aren't using take two columns and enter in on the first column the 12 3-letter month codes, and on the column next to it, put in the month numbers 1-12 that correspond to the month. Example in Cell Y1, you enter "Jan"; Cell Z1 you put "1", Cell Y2 you put "Feb", Cell Z2 you put "2"...and so on until you have all 12 months and their corresponding month numbers listed in the range Y1:Z12.

Now, lets say that you have "FY02" in cell A1 and in B1 you have "Jul HRS". In cell C1, you can use the formula

Which gives the result July 31,2002. You will need to format C1 as needed. Does that help?

Posted by Dan Aragon on January 24, 2002 9:38 AM

Oops made a slight mistake in formula

Should be:


Posted by Juan Pablo G. on January 24, 2002 9:50 AM

Just another option, without using VLOOKUP, but needs Analysis ToolPak.

Months in A2:A13, years in B1:F1. Formula in B2 and drag.

Juan Pablo G.

Posted by IML on January 24, 2002 10:56 AM

One more, just for fun

assumin FY03 in a2 and DEC HRS in b2
=DATE(YEAR((SUBSTITUTE(B2," HRS"," 1, ")&SUBSTITUTE(A2,"FY ",20))+0),MONTH((SUBSTITUTE(B2," HRS"," 1, ")&SUBSTITUTE(A2,"FY ",20))+0)+1,0)

Note this requires your FY and HRS to be in caps to work.