Full Date of Birth YYYY-MM-DD from 6 char. String YYMMDD

AKOsman1

New Member
Joined
Nov 19, 2023
Messages
24
Office Version
  1. 2007
Platform
  1. Windows
I have a 13 Character ID No. The first 6 characters represent the Date of Birth (YYMMDD). I want to display the date as YYYY-MM-DD eg;
470527 = 1947-05-27
500113 = 1950-01-13
000630 = 2000-06-30
050114 = 2005-01-14
Please show me how to achieve this.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Could be either. If it is 1922 the person would be 99 years old. If it is 2022 the person would be 1 year old. Neither would affect my system since they are both unemployable. A reasonable range to look at would be from 1945 to 2010.
 
Upvote 0
Please check.

1700756380812.png
 
Upvote 0
The original post said the IDs were 13 characters, so the formula should use two "mid" functions instead of a mid and a right.
Book1
BCDEF
2"1945 to 2010"13 charactersYYYY-MM-DD
3470527 = 1947-05-27470527ab12efg1947-05-27
4500113 = 1950-01-13500113ab12efg1950-01-13
5000630 = 2000-06-30000630ab12efg2000-06-30
6050114 = 2005-01-14050114ab12efg2005-01-14
Sheet1
Cell Formulas
RangeFormula
F3:F6F3=DATE(IF(VALUE(LEFT(D3,2))>=45,19&LEFT(D3,2),20&LEFT(D3,2)),MID(D3,3,2),MID(D3,5,2))
 
Upvote 0
@RustamMika
When suggesting formulas please either ..
  • Post your sample with XL2BB, or
  • Post you formula directly in your post using the formula code tags
    1700792644353.png
    , or

  • Post your formula as plain text directly in your post
.. so that the OP (& other readers) can actually copy your formula suggestion for testing

@Akos
If you are happy with a text result then try column B below. If you want actual dates, try the slight shortening of @Fluff's formula in column C and format the column with the Custom date formatting of "yyyy-mm-dd"

23 11 24.xlsm
ABC
1TextDate
2470527ab12efg1947-05-271947-05-27
3500113ab12efg1950-01-131950-01-13
4000630ab12efg2000-06-302000-06-30
5050114ab12efg2005-01-142005-01-14
Extract Date
Cell Formulas
RangeFormula
B2:B5B2=TEXT(20-(LEFT(A2,2)-45>0)&LEFT(A2,6),"0-00-00")
C2:C5C2=--(TEXT(20-(LEFT(A2,2)-45>0)&LEFT(A2,6),"0-00-00"))
 
Last edited:
Upvote 0
Absolutely Genius...How do I achieve the same result in Excel VBA?
 
Upvote 0
How do I achieve the same result in Excel VBA?
  1. Ask for that in your initial post so time isn't (perhaps) wasted developing formula suggestions. ;)
  2. Tell us which result you want as 2 different results were given in the marked solution. :)
 
Upvote 0
My sincere apologies. I forgot to mention in my initial request that I wanted the solution in Excel Vba code. I only realized my error after I received your answer in Excel only.
 
Upvote 0

Forum statistics

Threads
1,215,086
Messages
6,123,040
Members
449,092
Latest member
ikke

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