View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
MEAD5432 MEAD5432 is offline
external usenet poster
 
Posts: 28
Default Formatting Dates

That works. Here is a supplemental question for you:

The function works for dates that have double digit months. Single digit
months (January - September) don't have a "0" in front of the month making
the formula return the wrong date.

Example:

4/17/07 is in the spreadsheet as "41707". Due to the cell format, a "0" is
automatically added. Using =DATE(RIGHT(A1,2),LEFT(A1,2),MID(A1,3,2)) in a
date formatted cell gives me "07/09/10". If I add a "0" in front of "41707",
it gives me the correct result but since the spreadsheet has about 5,000
rows, I can't readily devote that much time.

Thoughts?

"Toppers" wrote:

In a helper column format as DATE

=DATE(RIGHT(A1,2),LEFT(A1,2),MID(A1,3,2))



"MEAD5432" wrote:

I have a column of dates. These dates are stored in the cell as "112482" and
the cell is formatted as "00\/00\/00" so that in the cell it looks like:
"11/24/82".

The problem is, I can't sort these dates because they are not stored
correctly in the cell for Excel to recognize them like it should. For
instance, "112482" is seen by Excel as 112,482nd day after January 1st, 1900
or 12/18/2007.

It appears there is no function in Excel currently to format my dates
correctly so it can be sorted by Excel. Can I create one using VBA? What
would it be?