rearrange values in cell to date

J

J.W. Aldridge

uploaded cell values in column B show as

2009-04-11 

(does not read as a date)

Need code that will check to see if any value as above exist in column
B, if so change order to format that reads as a date.

04/11/2009
 
R

Rick Rothstein

In what way is it "not a date"... does it have an apostrophe in front of it
(look in the Formula Bar, not the cell, to see it this is the case) or is
the cell formatted as Text?

--
Rick (MVP - Excel)


uploaded cell values in column B show as

2009-04-11

(does not read as a date)

Need code that will check to see if any value as above exist in column
B, if so change order to format that reads as a date.

04/11/2009
 
K

Kassie

Most likely your cells have been formatted as text. Reformat as General.
Now press <F2>, and then press <Enter> That should change it to dd-mm-yyyy,
provided that is how your date format has been set. It might also change it
to dd/mm/yyyy, but it would still be a date.

--
HTH

Kassie

Replace xxx with hotmail
 
J

J.W. Aldridge

kept digging to find out problem...

found out there's a trailing space at the end of 2009-04-11 which
prevents it from being read as date or even changed into. I tried
several vba codes to remove trailing spaces, but for some reason that
doesnt work either. I download the data in its current format so I'm
guessing its reading as one object somehow? These numbers are all in
one column/string. Any suggestions would be appreciated.
 
R

Rick Rothstein

You didn't answer the questions I asked you in my other post, but based on
what you have said, I'm guessing the cells are formatted as text. If that is
the case, the try this... select your column of dates, click
Data/TextToColumns on Excel's menu bar and click the Finish button on the
dialog box that appears. Doing this should change any of your "text dates",
with or without trailing spaces, to real dates that you can then format as
you wish.
 
K

Kassie

Stay away from the VBA my friend. try =TRIM(Cell reference). However, this
should not prevent it from being seen as a date. It is beginning to sound to
me as if you import this data via a csv or txt file. Iow, it is seen as
text. If so, save as a .xls, then format the cells as General, <F2> and
<Enter> on a cell to see what happens.
--
HTH

Kassie

Replace xxx with hotmail
 

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