View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sloth Sloth is offline
external usenet poster
 
Posts: 252
Default Extracting a Date from a YYYYMM number

=DATE(YEAR(A22),MONTH(A22)+1,0)

this formula will give the last day of the current month in a cell A22.

When you try using the TEXT function you are looking at the serial number of
the date.

"Matt" wrote:

Hi Guys

I have a column of dates in the format YYYYMM and I want to extract a date
from this. Specifically the last day of the month mentioned
I was thinking =TEXT(MID(A22,5,2),"MMM") would return me Feb as it is
pointing at the '02' the second month. But it returns 'Jan', presumbly
becausing it is picking up 2nd of Jan 1900.

Then I was going to use something like ="MONTH(E2)+1" to give me the last
day of the month. Didn't work out though....

Thanks for reading this far, and for any help you might be able to give me

Matt