Date problem

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
Well I thought I had this one fixed, but forgot about the end of year.

I have a date formatted like:
20041200
I use a formula:
=MID(K2,5,2)+1&"/"&"01"&"/"&LEFT(K2,4)
that gives me: 13/01/2004

which isn't what I expected. I needed 01/01/2005

Could someone please give me a formula that would give me that?

thanks . . . texasalynn
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
20041200 stands for what? And, what do you want to calculate from it?

20041200 is a text field (an invoice period) that I need to calculate the next month.

I came up with
Code:
=IF(MID(K2,5,2)<>"12",MID(K2,5,2)+1&"/"&"01"&"/"&LEFT(K2,4),"01"&"/"&"01"&"/"&LEFT(K2,4)+1)

thanks . . . .texasalynn
 
Upvote 0
texasalynn said:
20041200 stands for what? And, what do you want to calculate from it?

20041200 is a text field (an invoice period) that I need to calculate the next month.

I came up with
Code:
=IF(MID(K2,5,2)<>"12",MID(K2,5,2)+1&"/"&"01"&"/"&LEFT(K2,4),"01"&"/"&"01"&"/"&LEFT(K2,4)+1)

thanks . . . .texasalynn

But what does it mean - Year: 2004, Month:12, ...?
 
Upvote 0
texasalynn said:
no because as I said it is a text field and not a true date

Thanks . . . texasalynn

DATE() coerces text-formatted numbers to real numbers implicitly. Just give it a try.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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