View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Convert a text field to a date

On Tue, 11 Mar 2008 15:40:50 +0000, dslocum
wrote:


I have researched this forum and have most of my problem solved. My
customer has two columns of data representing a client's birthday; A1
has the birth year formatted as yyyy. A2 has the birth month and day
formatted as mm/dd. Here's the problem, A2 is formatted as "General"
and therefore truncated 0827 (Aug 27) as 827. I wish to use the =Date
function to basically concantenate these cells but I need to know how
to convert 827 into 0827 so that I might use the =Left(A2,2) and
=Right(A2,2) to break out the month and day. Am I heading in the right
direction?



=DATE(A1,INT(A2/100),MOD(A2/100,1)*100)

Although, if by columns you really mean columns, and not rows as you gave in
your example, then:

=DATE(A1,INT(B1/100),MOD(B1/100,1)*100)

--ron