#1   Report Post  
Posted to microsoft.public.excel.misc
Gerald
 
Posts: n/a
Default date format help

would appreciate if I get help in my query

I have a excel file exported which has 500 rows in which date is in
mm/dd/yyyy format.

Need to have in dd/mm/yyyy format, tried text to columns, custom change date
format, nothing seems to work

plz help

thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
josnah
 
Posts: n/a
Default date format help


Try This. You will have to select the range of cells first.

Sub Fixmmddyyyy()
If MsgBox("Fix mm/dd/yyyy to dd/mm/yyyy?", vbOKCancel) = vbCancel
Then Exit Sub
Application.ScreenUpdating = False
Dim Cell As Range
Selection.NumberFormat = "dd/mm/yyyy"
On Error Resume Next
For Each Cell In Selection
If Len(Cell) = 10 Then
Cell.Value = DateSerial(Right _
(Cell.Value, 4), Left(Cell.Value, _
2), Mid(Cell.Value, 4, 2))
End If
Next Cell
Application.ScreenUpdating = True
End Sub


--
josnah
------------------------------------------------------------------------
josnah's Profile: http://www.excelforum.com/member.php...fo&userid=6334
View this thread: http://www.excelforum.com/showthread...hreadid=548068

  #3   Report Post  
Posted to microsoft.public.excel.misc
mrice
 
Posts: n/a
Default date format help


If you try to change the format of the date cell to general, what
happens? Do you get a five digit number beginning with a 3?

If you don't then Excel is not recognising the value as a date. Do you
have any leading or trailing spaces on the date - these might cause
problems?


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=548068

  #4   Report Post  
Posted to microsoft.public.excel.misc
Gerald
 
Posts: n/a
Default date format help

yes, I am getting 5 digit number beg. with 3



"mrice" wrote:


If you try to change the format of the date cell to general, what
happens? Do you get a five digit number beginning with a 3?

If you don't then Excel is not recognising the value as a date. Do you
have any leading or trailing spaces on the date - these might cause
problems?


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=548068


  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default date format help

If you format the cell in an unambiguous date format (mmmm dd, yyyy), do your
dates still look like what you expect?

01/02/2006
could be January 02, 2006 or February 01, 2006.

If the dates are correct, just change the format to dd/mm/yyyy.

If the dates are not correct, I would re-import those values once more.

If they come from a text file, you can specify that your dates are already in
dmy order.

Gerald wrote:

would appreciate if I get help in my query

I have a excel file exported which has 500 rows in which date is in
mm/dd/yyyy format.

Need to have in dd/mm/yyyy format, tried text to columns, custom change date
format, nothing seems to work

plz help

thanks


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Gerald
 
Posts: n/a
Default date format help

did everything as suggested but still the date is in mm/dd/yyyy format

plz help

many thanks

"Dave Peterson" wrote:

If you format the cell in an unambiguous date format (mmmm dd, yyyy), do your
dates still look like what you expect?

01/02/2006
could be January 02, 2006 or February 01, 2006.

If the dates are correct, just change the format to dd/mm/yyyy.

If the dates are not correct, I would re-import those values once more.

If they come from a text file, you can specify that your dates are already in
dmy order.

Gerald wrote:

would appreciate if I get help in my query

I have a excel file exported which has 500 rows in which date is in
mm/dd/yyyy format.

Need to have in dd/mm/yyyy format, tried text to columns, custom change date
format, nothing seems to work

plz help

thanks


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
Fred Smith
 
Posts: n/a
Default date format help

Now you know you have text, not an Excel date. You have two choices:

1. Keep the data as text, in which case you would convert to dd/mm/yyyy format
using:
=mid(a1,4,3)&left(a1,3)&right(a1,4)

2. Convert to an Excel date. Text to Columns should do this for you. If it
doesn't, it likely means you have extraneous characters in your cells. You can
convert the date yourself using something like:

=date(right(a1,4),left(a1,2),mid(a1,4,2))

but you may have to adjust the character positions based on the extraneous
characters you have.

--
Regards,
Fred


"Gerald" wrote in message
...
did everything as suggested but still the date is in mm/dd/yyyy format

plz help

many thanks

"Dave Peterson" wrote:

If you format the cell in an unambiguous date format (mmmm dd, yyyy), do your
dates still look like what you expect?

01/02/2006
could be January 02, 2006 or February 01, 2006.

If the dates are correct, just change the format to dd/mm/yyyy.

If the dates are not correct, I would re-import those values once more.

If they come from a text file, you can specify that your dates are already in
dmy order.

Gerald wrote:

would appreciate if I get help in my query

I have a excel file exported which has 500 rows in which date is in
mm/dd/yyyy format.

Need to have in dd/mm/yyyy format, tried text to columns, custom change
date
format, nothing seems to work

plz help

thanks


--

Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.misc
Gerald
 
Posts: n/a
Default date format help

thanks for your reply

used the formulae =MID(A5,4,3)&LEFT(A5,4)&RIGHT(A5,1) to get the output as
dd/mm/yyyy

for the fields with single digit dates e.g 06/07/06 works fine and gives me
result as 07/06/06 but if the field has 06/10/06 it gives me an output as
6/06/106

please help

thanks



"Fred Smith" wrote:

Now you know you have text, not an Excel date. You have two choices:

1. Keep the data as text, in which case you would convert to dd/mm/yyyy format
using:
=mid(a1,4,3)&left(a1,3)&right(a1,4)

2. Convert to an Excel date. Text to Columns should do this for you. If it
doesn't, it likely means you have extraneous characters in your cells. You can
convert the date yourself using something like:

=date(right(a1,4),left(a1,2),mid(a1,4,2))

but you may have to adjust the character positions based on the extraneous
characters you have.

--
Regards,
Fred


"Gerald" wrote in message
...
did everything as suggested but still the date is in mm/dd/yyyy format

plz help

many thanks

"Dave Peterson" wrote:

If you format the cell in an unambiguous date format (mmmm dd, yyyy), do your
dates still look like what you expect?

01/02/2006
could be January 02, 2006 or February 01, 2006.

If the dates are correct, just change the format to dd/mm/yyyy.

If the dates are not correct, I would re-import those values once more.

If they come from a text file, you can specify that your dates are already in
dmy order.

Gerald wrote:

would appreciate if I get help in my query

I have a excel file exported which has 500 rows in which date is in
mm/dd/yyyy format.

Need to have in dd/mm/yyyy format, tried text to columns, custom change
date
format, nothing seems to work

plz help

thanks

--

Dave Peterson




  #9   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph
 
Posts: n/a
Default date format help

"Gerald" wrote in message
...

"Fred Smith" wrote:

Now you know you have text, not an Excel date. You have two choices:

1. Keep the data as text, in which case you would convert to dd/mm/yyyy
format
using:
=mid(a1,4,3)&left(a1,3)&right(a1,4)

....

thanks for your reply

used the formulae =MID(A5,4,3)&LEFT(A5,4)&RIGHT(A5,1) to get the output as
dd/mm/yyyy

for the fields with single digit dates e.g 06/07/06 works fine and gives
me
result as 07/06/06 but if the field has 06/10/06 it gives me an output as
6/06/106


Wouldn't =MID(A5,4,3)&LEFT(A5,3)&RIGHT(A5,2) make more sense?
I can't see why you've taken 4 characters for the month and only one for the
year? That wasn't what Fred suggested.
--
David Biddulph


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell date format doesnt change Jon Excel Worksheet Functions 5 March 7th 06 04:52 PM
Enforcing a date format on a cell/column ProdigalShawne Excel Discussion (Misc queries) 1 February 22nd 06 07:13 PM
Change general format to US date format woodlot4 Excel Discussion (Misc queries) 3 October 11th 05 12:29 AM
Customized Date Format Frustrated Excel Worksheet Functions 5 October 7th 05 11:30 PM
Compare dates (one cell not in date format) craigcsb Excel Discussion (Misc queries) 5 June 28th 05 05:07 PM


All times are GMT +1. The time now is 02:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"