Date formatting not working

jokkebal

New Member
Joined
Jun 26, 2014
Messages
18
I receive a file with a date in the format e.g. 20111025. So this example signifies October 25th, 2011. I need the ability to work with it as a true date (in furhter downstream formulas). This is what I did : assuming that 20111025 stands in A1, I would enter following formula in B1 : =CONCATENATE(RIGHT(RC[-1],2),""/"",MID(RC[-1],5,2),""/"",LEFT(RC[-1],4)). This results in 25/10/2011. I then copy this formula, paste it as a value and format the cell as date (short). BUT : it doesn't work : another formula downstream does not recognise this result as a date.

Strange : when I press F2 "edit" on the cell, it works. Problem is that I have many lines, so I have to press F2 - down - F2 - down - F2 - down etc etc.

How can I resolve this ?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try

=DATEVALUE(CONCATENATE(RIGHT(RC[-1],2),""/"",MID(RC[-1],5,2),""/"",LEFT(RC[-1],4)))

or even

=CONCATENATE(RIGHT(RC[-1],2),""/"",MID(RC[-1],5,2),""/"",LEFT(RC[-1],4))+0
Note +0 at the end
 
Upvote 0
You could try this for a list of dates in colun "A"
Code:
[COLOR="Navy"]Sub[/COLOR] MG27Aug02
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
Dn.Value = DateSerial(Mid(Dn, 1, 4), Mid(Dn, 5, 2), Mid(Dn, 7, 2))
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Hi all,

Thanks for your prompt and numerous replies.
I tried

=CONCATENATE(RIGHT(RC[-1],2),""/"",MID(RC[-1],5,2),""/"",LEFT(RC[-1],4))+0

This works perfectly.

Rgds.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

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