How do you format a number into a date?

G

Guest

I have a colunm of numbers some are eight digits long, 12221967, and some are
seven digits long, 8031985. How would i format them into a date like
12/22/1967 or 8/03/1985??
 
G

Guest

one wy ...

=IF(LEN(A1)=8,DATE(RIGHT(A1,4),MID(A1,3,2),LEFT(A1,2)),DATE(RIGHT(A1,4),MID(A1,2,2),LEFT(A1,1)))

format cell as DATE
 
G

Guest

.... I assumed UK date format (DDMMYYYY) so for US format:

=IF(LEN(A1)=8,DATE(RIGHT(A1,4),LEFT(A1,2),MID(A1,3,2)),DATE(RIGHT(A1,4),LEFT(A1,1),MID(A1,2,2)))
 
G

Guest

hmm, i tried this and i get a Value error in the cell. I must be doing
something wrong.
 
P

Pete_UK

Check that your numbers are numbers and not text with leading or
trailing spaces - if you do have these then you can get rid of them
using TRIM(A1) wherever A1 appears in Toppers' formula.

Hope this helps.

Pete
 
D

Dave Peterson

Another way:
Insert a helper column and fill it with formulas like:

=--TEXT(A1,"00\/00\/0000")

Format that column as a date.

Then select that helper column
edit|copy
edit|paste special|values
and delete the original column of data???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top