convert date to number

mzalikhan

Board Regular
Joined
May 16, 2011
Messages
62
Hi all

I have dates in excel 2007 as 4/14/2007 (formatted as date) i want to change it to number as 20070414 (in number format).

In other words i have date as 4/14/2007. If i only change the format of the cell to "number" it would give me "39186". That is what I am NOT looking for. What i need is 20070414.

Please let me know how to do that?

Regards
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Perhaps

=TEXT(YEAR(A1),"0000")&TEXT(MONTH(A1),"00")&TEXT(DAY(A1),"00")
 
Upvote 0
WoooHooo that's a first Thanks Peter :), I'm normally rubbish at formuas ;)

It's only because that's how I'd do it in code :)

Code:
val(format(Now(),"YYYYMMDD"))
 
Upvote 0

Forum statistics

Threads
1,203,224
Messages
6,054,241
Members
444,711
Latest member
Stupid Idiot

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