View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
macropod macropod is offline
external usenet poster
 
Posts: 329
Default American date conversion macro

Hi Ant,

If the data are in a text file you want to import, changing your system's
regional settings to the US date format (eg mm-dd-yyyy) before importing the
data should suffice. Simply change the settings back afterwards.

If you've got a worksheet that's showing numeric values in the US date
format, you can change that via Format|Cells|Number|Date.

If you've got a worksheet that's showing text strings in the US date format,
you could use a formula like:
=MID(A1,FIND("/",A1)+1,FIND("/",REPLACE(A1,FIND("/",A1),1,"
"))-FIND("/",A1)-1)&"/"&LEFT(A1,FIND("/",A1)-1)&"/"&RIGHT(A1,LEN(A1)-FIND("/
",REPLACE(A1,FIND("/",A1),1," ")))
to turn a US date in A1 into the equivalent "dd-mm-yyyy" strings, or
=--(MID(A1,FIND("/",A1)+1,FIND("/",REPLACE(A1,FIND("/",A1),1,"
"))-FIND("/",A1)-1)&"/"&LEFT(A1,FIND("/",A1)-1)&"/"&RIGHT(A1,LEN(A1)-FIND("/
",REPLACE(A1,FIND("/",A1),1," "))))
to convert them to serial values that you could then format as dates.

Cheers

--
macropod
[MVP - Microsoft Word]


"Ant" wrote in message
...
Does anyone have some simple code that I can use to convert American date
format to English format. eg. 12/25/06 to 25/12 06. It will have to take

into
account single and double digits.

Cheers,
Ant.