Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 516
Default Extracting a Date from a YYYYMM number

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

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Extracting a Date from a YYYYMM number

Try this:

With
A YYYYMM value in A1

B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
Format B1 as a date

If A1: 200603
B1 returns 03/31/2006

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Extracting a Date from a YYYYMM number

Wouldn't it be nice if the formula I posted actually referenced cell A1?

With
A YYYYMM value in A1

B1: =DATE(LEFT(A1,4),RIGHT(A1,2)+1,0)
Format B1 as a date

------------------
Instead of B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
------------------

***********
Regards,
Ron

XL2002, WinXP


"Ron Coderre" wrote:

Try this:

With
A YYYYMM value in A1

B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
Format B1 as a date

If A1: 200603
B1 returns 03/31/2006

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"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

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 516
Default Extracting a Date from a YYYYMM number

Thanks Ron

That's just what I needed to crack the problem. In full I used

="Year to "&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"DD")& "
"&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"MMM") &"
"&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"yyyy" )

Cheers

Matt

"Ron Coderre" wrote:

Wouldn't it be nice if the formula I posted actually referenced cell A1?

With
A YYYYMM value in A1

B1: =DATE(LEFT(A1,4),RIGHT(A1,2)+1,0)
Format B1 as a date

------------------
Instead of B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
------------------

***********
Regards,
Ron

XL2002, WinXP


"Ron Coderre" wrote:

Try this:

With
A YYYYMM value in A1

B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
Format B1 as a date

If A1: 200603
B1 returns 03/31/2006

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"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



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default Extracting a Date from a YYYYMM number

Maybe you'd like to use something like this, instead?:

="Year to "&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"dd mmm yyyy")

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Matt" wrote:

Thanks Ron

That's just what I needed to crack the problem. In full I used

="Year to "&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"DD")& "
"&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"MMM") &"
"&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"yyyy" )

Cheers

Matt

"Ron Coderre" wrote:

Wouldn't it be nice if the formula I posted actually referenced cell A1?

With
A YYYYMM value in A1

B1: =DATE(LEFT(A1,4),RIGHT(A1,2)+1,0)
Format B1 as a date

------------------
Instead of B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
------------------

***********
Regards,
Ron

XL2002, WinXP


"Ron Coderre" wrote:

Try this:

With
A YYYYMM value in A1

B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
Format B1 as a date

If A1: 200603
B1 returns 03/31/2006

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"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

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 516
Default Extracting a Date from a YYYYMM number

Much Tidier!

Thanks again Ron


"Ron Coderre" wrote:

Maybe you'd like to use something like this, instead?:

="Year to "&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"dd mmm yyyy")

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Matt" wrote:

Thanks Ron

That's just what I needed to crack the problem. In full I used

="Year to "&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"DD")& "
"&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"MMM") &"
"&TEXT(DATE(LEFT(A1,4),RIGHT(A1,2)+1,0),"yyyy" )

Cheers

Matt

"Ron Coderre" wrote:

Wouldn't it be nice if the formula I posted actually referenced cell A1?

With
A YYYYMM value in A1

B1: =DATE(LEFT(A1,4),RIGHT(A1,2)+1,0)
Format B1 as a date

------------------
Instead of B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
------------------

***********
Regards,
Ron

XL2002, WinXP


"Ron Coderre" wrote:

Try this:

With
A YYYYMM value in A1

B1: =DATE(LEFT(D13,4),RIGHT(D13,2)+1,0)
Format B1 as a date

If A1: 200603
B1 returns 03/31/2006

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CALCULATE NUMBER OF DAYS BETWEEN A DATE AND TODAY South texas man Excel Worksheet Functions 4 May 19th 06 08:37 PM
date number separation steven Excel Discussion (Misc queries) 2 May 16th 06 05:42 AM
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Converting number or text to a Date Format samhain New Users to Excel 2 October 17th 05 02:28 PM
Use Julian Date To Create Serial Number antho10359 Excel Discussion (Misc queries) 4 December 9th 04 01:50 AM


All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"