Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Converting a number todate

In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits to
date of birth, without
any luck. The main problem being the year of birth forms the first 2 digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7 digits] .
Any help would be appreciated
HJN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

I am guessing no one in your country will ever live to be more than 100?
Here is a formula that seems to work for those less than 100 years old...

=DATE(1900+100*(IF(LEFT(A1,2)<=RIGHT(YEAR(NOW()),2 ),IF(--MID(A1,3,2)<=MONTH(NOW()),IF(--MID(A1,5,2)<=DAY(NOW()),1,0),0),0))+LEFT(A1,2),MID (A1,3,2),MID(A1,5,2))

Rick


"Hennie Neuhoff" wrote in message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

In looking at this formula, I am pretty sure it does NOT work correctly, so
don't use it.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I am guessing no one in your country will ever live to be more than 100?
Here is a formula that seems to work for those less than 100 years old...

=DATE(1900+100*(IF(LEFT(A1,2)<=RIGHT(YEAR(NOW()),2 ),IF(--MID(A1,3,2)<=MONTH(NOW()),IF(--MID(A1,5,2)<=DAY(NOW()),1,0),0),0))+LEFT(A1,2),MID (A1,3,2),MID(A1,5,2))

Rick


"Hennie Neuhoff" wrote in
message ...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

Here is a corrected formula that will do what I intended my first (flawed)
formula to do...

=DATE(IF(LEFT(A1,2)=RIGHT(YEAR(NOW()),2),1900+100* (DATE(YEAR(NOW()),MID(A1,3,2),MID(A1,5,2))<=TODAY( ))+LEFT(A1,2),1900+100*(LEFT(A1,2)<RIGHT(YEAR(NOW( )),2))+LEFT(A1,2)),MID(A1,3,2),MID(A1,5,2))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I am guessing no one in your country will ever live to be more than 100?
Here is a formula that seems to work for those less than 100 years old...

=DATE(1900+100*(IF(LEFT(A1,2)<=RIGHT(YEAR(NOW()),2 ),IF(--MID(A1,3,2)<=MONTH(NOW()),IF(--MID(A1,5,2)<=DAY(NOW()),1,0),0),0))+LEFT(A1,2),MID (A1,3,2),MID(A1,5,2))

Rick


"Hennie Neuhoff" wrote in
message ...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Converting a number todate

I just ran 520210987654 through DataText to ColumnFixed Width.

Select first 6 numbers and Column Data FormatYMD.

Select other column and "Skip" then Finish.

February 10, 1952 was the result in Column A

After formatting of course.


Gord Dibben MS Excel MVP


On Mon, 11 Feb 2008 20:17:32 -0500, "Rick Rothstein \(MVP - VB\)"
wrote:

Here is a corrected formula that will do what I intended my first (flawed)
formula to do...

=DATE(IF(LEFT(A1,2)=RIGHT(YEAR(NOW()),2),1900+100 *(DATE(YEAR(NOW()),MID(A1,3,2),MID(A1,5,2))<=TODAY ())+LEFT(A1,2),1900+100*(LEFT(A1,2)<RIGHT(YEAR(NOW ()),2))+LEFT(A1,2)),MID(A1,3,2),MID(A1,5,2))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I am guessing no one in your country will ever live to be more than 100?
Here is a formula that seems to work for those less than 100 years old...

=DATE(1900+100*(IF(LEFT(A1,2)<=RIGHT(YEAR(NOW()),2 ),IF(--MID(A1,3,2)<=MONTH(NOW()),IF(--MID(A1,5,2)<=DAY(NOW()),1,0),0),0))+LEFT(A1,2),MID (A1,3,2),MID(A1,5,2))

Rick


"Hennie Neuhoff" wrote in
message ...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

Ron posted that process a little later on in this thread and I responded
with what I thought was an incorrect result from it (given the OP's stated
meaning of the first 6 digits). The example I gave was the first six digits
being 220210 and the fact that Text To Column yielded a date of 2/10/2022
instead of 2/10/1922 which is what I presume the correct result should be.

Rick


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
I just ran 520210987654 through DataText to ColumnFixed Width.

Select first 6 numbers and Column Data FormatYMD.

Select other column and "Skip" then Finish.

February 10, 1952 was the result in Column A

After formatting of course.


Gord Dibben MS Excel MVP


On Mon, 11 Feb 2008 20:17:32 -0500, "Rick Rothstein \(MVP - VB\)"
wrote:

Here is a corrected formula that will do what I intended my first (flawed)
formula to do...

=DATE(IF(LEFT(A1,2)=RIGHT(YEAR(NOW()),2),1900+10 0*(DATE(YEAR(NOW()),MID(A1,3,2),MID(A1,5,2))<=TODA Y())+LEFT(A1,2),1900+100*(LEFT(A1,2)<RIGHT(YEAR(NO W()),2))+LEFT(A1,2)),MID(A1,3,2),MID(A1,5,2))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I am guessing no one in your country will ever live to be more than 100?
Here is a formula that seems to work for those less than 100 years old...

=DATE(1900+100*(IF(LEFT(A1,2)<=RIGHT(YEAR(NOW()),2 ),IF(--MID(A1,3,2)<=MONTH(NOW()),IF(--MID(A1,5,2)<=DAY(NOW()),1,0),0),0))+LEFT(A1,2),MID (A1,3,2),MID(A1,5,2))

Rick


"Hennie Neuhoff" wrote in
message ...
In our country all citizens have a unique [13digit] identity number,
the
first 6 digits being date of bitrh. I've tried to convert these 6
digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Converting a number todate

Missed that part of the thread.

Change the Regional Settings in Windows if the years will be prior to current
range of 1939 to 2039 or whaterver.

Yeah, I know..........that is a pain in the butt.


Gord

On Tue, 12 Feb 2008 14:55:39 -0500, "Rick Rothstein \(MVP - VB\)"
wrote:

Ron posted that process a little later on in this thread and I responded
with what I thought was an incorrect result from it (given the OP's stated
meaning of the first 6 digits). The example I gave was the first six digits
being 220210 and the fact that Text To Column yielded a date of 2/10/2022
instead of 2/10/1922 which is what I presume the correct result should be.

Rick


"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
I just ran 520210987654 through DataText to ColumnFixed Width.

Select first 6 numbers and Column Data FormatYMD.

Select other column and "Skip" then Finish.

February 10, 1952 was the result in Column A

After formatting of course.


Gord Dibben MS Excel MVP


On Mon, 11 Feb 2008 20:17:32 -0500, "Rick Rothstein \(MVP - VB\)"
wrote:

Here is a corrected formula that will do what I intended my first (flawed)
formula to do...

=DATE(IF(LEFT(A1,2)=RIGHT(YEAR(NOW()),2),1900+1 00*(DATE(YEAR(NOW()),MID(A1,3,2),MID(A1,5,2))<=TOD AY())+LEFT(A1,2),1900+100*(LEFT(A1,2)<RIGHT(YEAR(N OW()),2))+LEFT(A1,2)),MID(A1,3,2),MID(A1,5,2))

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I am guessing no one in your country will ever live to be more than 100?
Here is a formula that seems to work for those less than 100 years old...

=DATE(1900+100*(IF(LEFT(A1,2)<=RIGHT(YEAR(NOW()),2 ),IF(--MID(A1,3,2)<=MONTH(NOW()),IF(--MID(A1,5,2)<=DAY(NOW()),1,0),0),0))+LEFT(A1,2),MID (A1,3,2),MID(A1,5,2))

Rick


"Hennie Neuhoff" wrote in
message ...
In our country all citizens have a unique [13digit] identity number,
the
first 6 digits being date of bitrh. I've tried to convert these 6
digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Converting a number todate

=TEXT(A1,"yymmdd")

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Hennie Neuhoff" wrote in message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

You are going in the wrong direction... the OP has the number and wants to
produce a date from it... your formula assumes just the opposite (that the
OP has the date and wants to produce the number).

Rick


"Bob Phillips" wrote in message
...
=TEXT(A1,"yymmdd")

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Hennie Neuhoff" wrote in
message ...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Converting a number todate

Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
....Check: Fixed Width.......Click [Next]
....Insert a breakpoint after the 6th character (by clicking)...Click [Next]
....Select the 1st Col...Check: Date...YMD...Click [Next]
....Select the 2st Col...Check: Do not import
....Destinatioin: Select a cell off to the right of the 1st ID Number
....Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN






  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

I'm not sure where the 1900/2000 century switchover breakpoint is, but if
the cell contains this number...

2202103242344

as an example (the numbers from position 7 onward are immaterial), using
your Text To Column procedure will convert it to this...

2/10/2022

Based on what the OP said the first 6-digits represented, I would guess the
year should be 1922, not 2022.

Rick


"Ron Coderre" wrote in message
...
Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
...Check: Fixed Width.......Click [Next]
...Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
...Select the 1st Col...Check: Date...YMD...Click [Next]
...Select the 2st Col...Check: Do not import
...Destinatioin: Select a cell off to the right of the 1st ID Number
...Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN





  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Converting a number todate

Not sure if that's an issue or not.
We'll see, I guess.

--------------------------

Best Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"Rick Rothstein (MVP - VB)" wrote in
message ...
I'm not sure where the 1900/2000 century switchover breakpoint is, but if
the cell contains this number...

2202103242344

as an example (the numbers from position 7 onward are immaterial), using
your Text To Column procedure will convert it to this...

2/10/2022

Based on what the OP said the first 6-digits represented, I would guess
the year should be 1922, not 2022.

Rick


"Ron Coderre" wrote in message
...
Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
...Check: Fixed Width.......Click [Next]
...Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
...Select the 1st Col...Check: Date...YMD...Click [Next]
...Select the 2st Col...Check: Do not import
...Destinatioin: Select a cell off to the right of the 1st ID Number
...Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN







  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Converting a number todate

Tanks. I've tried to do this with a macro. The objective being if the user
key in the ID no. to obtain the date of birth.
--
HJN


"Ron Coderre" wrote:

Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
....Check: Fixed Width.......Click [Next]
....Insert a breakpoint after the 6th character (by clicking)...Click [Next]
....Select the 1st Col...Check: Date...YMD...Click [Next]
....Select the 2st Col...Check: Do not import
....Destinatioin: Select a cell off to the right of the 1st ID Number
....Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN





  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

You should be able to use this function within your macro...

Function GetBirthday(IDnumber As String) As Date
Dim Yr As Long
Dim Mn As Long
Dim Dy As Long
Yr = Left(IDnumber, 2)
Mn = Mid(IDnumber, 3, 2)
Dy = Mid(IDnumber, 5, 2)
If Yr = Year(Now) Mod 2000 Then
Yr = 1900 - 100 * (DateSerial(Year(Now), Mn, Dy) <= Date) + Yr
Else
Yr = 1900 - 100 * (Yr < Year(Now) Mod 2000) + Yr
End If
GetBirthday = DateSerial(Yr, Mn, Dy)
End Function

You could use it something like this...

Sub TestMacro()
Dim Answer As String
Answer = InputBox("Enter ID number...")
If Answer Like "######*" Then
MsgBox "Birthday: " & GetBirthday(Answer)
End If
End Sub

Rick


"Hennie Neuhoff" wrote in message
...
Tanks. I've tried to do this with a macro. The objective being if the user
key in the ID no. to obtain the date of birth.
--
HJN


"Ron Coderre" wrote:

Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
....Check: Fixed Width.......Click [Next]
....Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
....Select the 1st Col...Check: Date...YMD...Click [Next]
....Select the 2st Col...Check: Do not import
....Destinatioin: Select a cell off to the right of the 1st ID Number
....Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number,
the
first 6 digits being date of bitrh. I've tried to convert these 6
digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN






  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Converting a number todate

Thank you so much. I enjoyed the discussion between your guys!!
--
HJN


"Rick Rothstein (MVP - VB)" wrote:

You should be able to use this function within your macro...

Function GetBirthday(IDnumber As String) As Date
Dim Yr As Long
Dim Mn As Long
Dim Dy As Long
Yr = Left(IDnumber, 2)
Mn = Mid(IDnumber, 3, 2)
Dy = Mid(IDnumber, 5, 2)
If Yr = Year(Now) Mod 2000 Then
Yr = 1900 - 100 * (DateSerial(Year(Now), Mn, Dy) <= Date) + Yr
Else
Yr = 1900 - 100 * (Yr < Year(Now) Mod 2000) + Yr
End If
GetBirthday = DateSerial(Yr, Mn, Dy)
End Function

You could use it something like this...

Sub TestMacro()
Dim Answer As String
Answer = InputBox("Enter ID number...")
If Answer Like "######*" Then
MsgBox "Birthday: " & GetBirthday(Answer)
End If
End Sub

Rick


"Hennie Neuhoff" wrote in message
...
Tanks. I've tried to do this with a macro. The objective being if the user
key in the ID no. to obtain the date of birth.
--
HJN


"Ron Coderre" wrote:

Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
....Check: Fixed Width.......Click [Next]
....Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
....Select the 1st Col...Check: Date...YMD...Click [Next]
....Select the 2st Col...Check: Do not import
....Destinatioin: Select a cell off to the right of the 1st ID Number
....Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number,
the
first 6 digits being date of bitrh. I've tried to convert these 6
digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN








  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Converting a number todate

Maybe this:

With A1 formatted as TEXT

B1:
=--(TEXT(MID(A1,3,4),"00\/00\/")&IF(--(TEXT(MID(A1,3,4),"00\/00\/")&
"20"&LEFT(A1,2))TODAY(),19,20)&LEFT(A1,2))

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"Ron Coderre" wrote in message
...
Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
...Check: Fixed Width.......Click [Next]
...Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
...Select the 1st Col...Check: Date...YMD...Click [Next]
...Select the 2st Col...Check: Do not import
...Destinatioin: Select a cell off to the right of the 1st ID Number
...Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN








  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

Very nice! Your formula seems to generate the same values mine does, but
yours is shorter and uses a lot less function calls.

Rick


"Ron Coderre" wrote in message
...
Maybe this:

With A1 formatted as TEXT

B1:
=--(TEXT(MID(A1,3,4),"00\/00\/")&IF(--(TEXT(MID(A1,3,4),"00\/00\/")&
"20"&LEFT(A1,2))TODAY(),19,20)&LEFT(A1,2))

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"Ron Coderre" wrote in message
...
Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
...Check: Fixed Width.......Click [Next]
...Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
...Select the 1st Col...Check: Date...YMD...Click [Next]
...Select the 2st Col...Check: Do not import
...Destinatioin: Select a cell off to the right of the 1st ID Number
...Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN









  #18   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Converting a number todate

Thanks,Rick....Not being an Excel "date formula guru", these are fun to play
with.

I worked on it a little more and came up with this:
=LOOKUP(TODAY(),INDEX(--(TEXT(MID(A1,3,4),"00\/00\/")&{"19","20"}&LEFT(A1,2)),0))

--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"Rick Rothstein (MVP - VB)" wrote in
message ...
Very nice! Your formula seems to generate the same values mine does, but
yours is shorter and uses a lot less function calls.

Rick


"Ron Coderre" wrote in message
...
Maybe this:

With A1 formatted as TEXT

B1:
=--(TEXT(MID(A1,3,4),"00\/00\/")&IF(--(TEXT(MID(A1,3,4),"00\/00\/")&
"20"&LEFT(A1,2))TODAY(),19,20)&LEFT(A1,2))

Does that help?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)


"Ron Coderre" wrote in message
...
Try this to create a list of the dates off to the right of the original
values:

Select the single column range of ID Numbers

From the Excel Main Menu:
<data<text-to-columns
...Check: Fixed Width.......Click [Next]
...Insert a breakpoint after the 6th character (by clicking)...Click
[Next]
...Select the 1st Col...Check: Date...YMD...Click [Next]
...Select the 2st Col...Check: Do not import
...Destinatioin: Select a cell off to the right of the 1st ID Number
...Click [Finish]


Is that something you can work with?
Post back if you have more questions.
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"Hennie Neuhoff" wrote in
message
...
In our country all citizens have a unique [13digit] identity number,
the
first 6 digits being date of bitrh. I've tried to convert these 6
digits
to
date of birth, without
any luck. The main problem being the year of birth forms the first 2
digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7
digits] .
Any help would be appreciated
HJN










  #19   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Converting a number todate

Thanks,Rick....Not being an Excel "date formula guru", these are fun
to play with.


Yes, struggling to find shorter and shorter formula solutions is definitely
a fun process.

I worked on it a little more and came up with this:
=LOOKUP(TODAY(),INDEX(--(TEXT(MID(A1,3,4),"00\/00\/")&{"19","20"}&LEFT(A1,2)),0))


A nice, thinking-outside-of-the-box solution. Here is yet another formula
that turns out to be 3 characters shorter than your posted (still using 6
function calls though)...

=DATEVALUE((20-(LEFT(A1,6)TEXT(NOW(),"yymmdd")))&TEXT(LEFT(A1,6) ,"00-00-00"))

However, if you replace your TODAY function call with NOW (I don't think
that affect the functionality of formula any), then my formula becomes only
1 character shorter.

Rick

  #20   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Converting a number todate

On Sun, 10 Feb 2008 19:35:03 -0800, Hennie Neuhoff
wrote:

In our country all citizens have a unique [13digit] identity number, the
first 6 digits being date of bitrh. I've tried to convert these 6 digits to
date of birth, without
any luck. The main problem being the year of birth forms the first 2 digits,
ie a person born on 10 February 1952 IDnumber would be 520210[plus 7 digits] .
Any help would be appreciated
HJN


For a formula, perhaps:

=DATE(INT(A1/10^11)+1900+100*(INT(A1/10^11)<YEAR(TODAY())/100),
MOD(INT(A1/10^9),100),MOD(INT(A1/10^7),100))


--ron


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Negative Number to Postive number Tedd Excel Worksheet Functions 7 September 2nd 09 04:34 PM
converting a positive number to neg number in spreadsheets Spreadsheet question Excel Discussion (Misc queries) 3 June 28th 09 12:35 AM
Converting a negative number to a positive number Barb Excel Discussion (Misc queries) 3 November 1st 07 02:20 AM
Fill FromDate to ToDate RichardSchollar Excel Programming 0 December 21st 06 02:41 PM
converting number string to number with decimal rortiz Excel Worksheet Functions 2 September 15th 05 08:34 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"