Converting Number String to a Date

jmurg

New Member
Joined
Jan 25, 2010
Messages
8
I have a need to change a number string into a date. The number will always be formated as such: DDD-YY-NNNNNN

DDD represents the counted number of the day of the year
ex: 025 is January 25th and 365 is December 31st.

YY is the numerical year
ex: 09 is 2009 and 10 is 2010

NNNNNN are extra characters that do not apply for date purposes.

Given the above number, I'd like to create a formula that outputs the date as this format: MM/DD/YYYY ex: 01/25/2010

Does anyone have a suggestion on how to accomplish this?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try like this where data is in A2

=DATE(MID(A2,5,2)+100,1,LEFT(A2,3))

assumes all dates are this century
 
Upvote 0
very nicely done! you remind me of the circuit city commercials, "I guess you're just what I needed!" (singing the jingle):LOL:
You rock - I appreciate the prompt and accurate response!
 
Upvote 0
Can we add two small changes to this formula?

1. Can we make it so the format for the date output is MM/YY/YYYY? ... the formula output M/YY/YYYY when I used 025 for example.
2. Can we make it so if A2 has no value in it, no error appears in the cell? When nothing is in cell A2, I'm getting #VALUE in the cell where my new formula is located.
 
Upvote 0
I'm not sure I understand what you want for point 1. The formula returns a date so you can use

Format > Cells > Number > date

to format the output any way you like

for the second one you can just add an IF like this

=IF(A2="","",DATE(MID(A2,5,2)+100,1,LEFT(A2,3)))
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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