Andekongen
02-15-2018, 03:23 PM
Hi
I need somesupport to run simple calculation in a VBA user form, based on a Danish CPR-number.
In Demarkeach person has a unique CPR number with 10 digits.
The number couldlook like: 010270-1223
010270 isthe date of birth: 01 is the day, 02 is the month, 70 is the year meaning 1970
Is digit 7:0,1,2,3 is the person borne in 19xx
Is digit 7:4 or 9 is the person born in 19xx if the last 2 digits in the 6 digit is >36 are they < = is the person born in 20xx.
Is digit 7:5,6,7 or 8 and the last 2 digits in the 6 digit is = 36 are the person born in2000
I wouldlike to run the two below formulas based on the input in textbox 1:
Example:
Input Textbox1= 231117-5704
Problem 1: I would likeTtextbox2 to perform thecalculating with the result: 23-11-2017
“=TEXT(LEFT($A2;6);"00-00-00")+0” (Extractof date of birth and year without he 4 last digit)
Problem 2: I would likeTtextbox3 to perform thecalculating with the result:23-10-2020
“DATE(YEAR(C2)+3;MONTH(C2)-1;DAY(C2))” (Date of birth+ 2y and 11 months.
I hope someof you can support me with some magic.
I need somesupport to run simple calculation in a VBA user form, based on a Danish CPR-number.
In Demarkeach person has a unique CPR number with 10 digits.
The number couldlook like: 010270-1223
010270 isthe date of birth: 01 is the day, 02 is the month, 70 is the year meaning 1970
Is digit 7:0,1,2,3 is the person borne in 19xx
Is digit 7:4 or 9 is the person born in 19xx if the last 2 digits in the 6 digit is >36 are they < = is the person born in 20xx.
Is digit 7:5,6,7 or 8 and the last 2 digits in the 6 digit is = 36 are the person born in2000
I wouldlike to run the two below formulas based on the input in textbox 1:
Example:
Input Textbox1= 231117-5704
Problem 1: I would likeTtextbox2 to perform thecalculating with the result: 23-11-2017
“=TEXT(LEFT($A2;6);"00-00-00")+0” (Extractof date of birth and year without he 4 last digit)
Problem 2: I would likeTtextbox3 to perform thecalculating with the result:23-10-2020
“DATE(YEAR(C2)+3;MONTH(C2)-1;DAY(C2))” (Date of birth+ 2y and 11 months.
I hope someof you can support me with some magic.