Get year from personal number (10 digits)

Excel43

New Member
Joined
Jan 7, 2020
Messages
14
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hi, how can I get the birth date (YYYY-MM-DD) from a personal number that is just 10 digits?

The personal number is like this: YYMMDDXXXX (9001121515). It has no spaces or anything, just 10 digits.

I have this formula and it works if the person is born before 2000. But for 2000 and afterwards it shows "1900-" instead of "2000". For example, a person with the personal number "2101022222" is shown as "1901-01-02".

The formula right now (D3 is the cell containing the personal number):
VBA Code:
=DATE(LEFT(D3;2);MID(D3;3;2);MID(D3;5;2))

I cant change the personal number digits, so I have to come up with a solution . Any idea?
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi there. Try this. The 30 in the formula represents what the earliest date is expected (i.e. 1930), So any number that starts with 30 or more will be assumed to be 19xx. It will of course stop working properly for the year 2030 onwards, but you may choose a higher 'cutoff' if that happens.
Book2
D
2
32101022222
4
5
62021-01-02
Sheet1
Cell Formulas
RangeFormula
D6D6=DATE(IF(--LEFT(D3,2)>30,"19","20")&LEFT(D3,2),MID(D3,3,2),MID(D3,5,2))
 
Upvote 0
You're welcome and thanks for the feedback. A delayed-action Millenium Bug!
 
Upvote 0
Another way:

=--TEXT(IF(D3<3100000000,20,19)&LEFT(D3,6),"0000-00-00")
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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