Extract date in mm/dd/yyy

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
923
Office Version
  1. 365
Hi,

I have a list of employee numbers in the following format:

770205145598

The first two numbers are the year, second two digits are the month and the next two digits are the day. So, in this case the employees' date of birth is February 5 1977. Is there a way to extract the date of birth in mm/dd/yyyy format ? Thank you in advance.
 
Hi Rich Rothstein,

Thank you for your solution. I am getting #value! when I use this formula. Here is a screen print if this helps.
 

Attachments

  • 2021-07-31.png
    2021-07-31.png
    161.4 KB · Views: 9
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,

I am copying the data from another sheet which is in an excel table. The format in the original sheet is number. The result is as per the screen print.

1627730313264.png
 
Upvote 0
It looks to me that your default date format (Region Setting) is dd/mm/yyyy.
Yes you can reformat it for display purposes to show mm/dd/yyyy but any date conversion is still going to use your Region setting.
Based on this Rick's formula won't work for you, it is based on an US format date setting. It is giving #Value because it is using the 24 in your value in the mm position in your date format dd/mm/yyyy
If you want Excel to determine whether to use 19 or 20 for the year, then you simply modify @richh's formula dropping the "19" prefix.
Excel Formula:
=DATE( LEFT(A1,2), MID(A1,3,2), MID(A1, 5,2))

1627731566613.png
 
Upvote 0
@kumara_faith the problem you have is, you have the cell in the B column formatted as a date. Please see Post #5 in this thread.
 
Upvote 0
I assumed from the OP's thread title that dates were in the same format as on my system, namely, mm/dd/yyyy. I took the first six characters of the cell value (which the OP said describes a date) and put them into that format (using only two digits for the year), so the text manipulation part of my formula produced this... 02/05/77. Now that is just a text string; however, in Excel, if you involve a text string number in a mathematical calculation, Excel will convert the text to the actual number it represents in order to perform the mathematical operation. A date is just a number to Excel, so I wrapped the text concatenation in parentheses to group them all together, then I added zero to that (adding zero to any number does not change that number) so that Excel would convert it from text that looked like a date to a real date value. However, based on Alex's comment in Message #14, apparently the OP's native date format in not mm/dd/yy but rather dd/mm/yy and that he only wants the date shown as mm/dd/yy. Because of that, the text date I concatenated together appears to have the month and day values in the wrong order for the OP's system which is why it did not work for him.
 
Last edited:
Upvote 0
Ahhhhh. If I wasn't surrounded by all of these trees, I possibly could see the forest occasionally. Thank you @Rick Rothstein for the explanation.
 
Upvote 0
Hi,

My apologies. I have tried all three formula suggested but still the same. My apologies again for wasting your time, but could you guide me what actually I would need to do to get it right ?

1627794152200.png


1627794170748.png
 
Upvote 0
What is the natural date format on your computer? That is, when you put a real date in an Excel cell, does it display as mm/dd/yyyy or as dd/mm/yyyy?
 
Upvote 0

Forum statistics

Threads
1,215,737
Messages
6,126,570
Members
449,318
Latest member
Son Raphon

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