converting 8-digit number to date

G

Guest

I have been given an Excel spreadsheet with numbers in 8-digit text format.
For example, 20020812 would be August 12, 2002. How do I convert these to
some sort of date field that will allow me to perform calculations (count
days from one date to the next)?
 
D

Dave Peterson

If they're in one column...

Select the range
data|text to columns
choose fixed width and remove any lines that excel guessed
choose Date (ymd)
and plop it in the same range as where you picked it up.

And format those (now real) dates the way you want.
 
D

Don Guillett

a formula
=DATEVALUE(LEFT(F6,4)&"/"&MID(F6,5,2)&"/"&RIGHT(F6,2))
do you need a macro?
 
B

Biff

Hi!

Try this:

Select the range in question.
Goto Data>Text to Columns
Click Next, Next
Select Date
From the drop down select YMD
Click Finish

Biff
 
G

Guest

Assuming that your number is in cell A1, this formula will return a date:

=DATE(LEFT(A1,4),MID(A1,5,2),(RIGHT(A1,2)))
 
D

David Biddulph

DJ said:
I have been given an Excel spreadsheet with numbers in 8-digit text format.
For example, 20020812 would be August 12, 2002. How do I convert these to
some sort of date field that will allow me to perform calculations (count
days from one date to the next)?

Data/ Text to Columns/ Fixed Width
Select output as Date/ YMD
 
D

daddylonglegs

Text to columns would appear to be the best approach, although if yo
did want a formula here's a simple one

=TEXT(A1,"0000-00-00")+
 

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