Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Excel (or other) macro for cleaning date data

Does anyone have a good macro for taking date data that are in a
variety of formats and making them consistent? By format, I don't mean
that the cells are formatted differently, but that the data are all
recorded as, say, a string, but they all look different, e.g.

"01/05/92"
"01-07-84"
"Jan 12, 1991"
"January 1, 2000"
"10 January '05"

Is there any macro that is written to recognize that, say, the first
two are in mm/dd/yy format and to put them into a consistent style,
that the second, third, and fourth are in different formats, and to
put them into mm/dd/yy, etc.?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default Excel (or other) macro for cleaning date data


Record a macro and you will have one. It should include...
Replacing the quote marks and apostrophe with nothing (Edit | Replace)
Multiplying all of the dates by 1 (Edit | Paste Special | Multiply)
Changing the number format to mm/dd/yy (Format | Cells | Number (tab) | Custom
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)





wrote in message
Does anyone have a good macro for taking date data that are in a
variety of formats and making them consistent? By format, I don't mean
that the cells are formatted differently, but that the data are all
recorded as, say, a string, but they all look different, e.g.

"01/05/92"
"01-07-84"
"Jan 12, 1991"
"January 1, 2000"
"10 January '05"

Is there any macro that is written to recognize that, say, the first
two are in mm/dd/yy format and to put them into a consistent style,
that the second, third, and fourth are in different formats, and to
put them into mm/dd/yy, etc.?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Excel (or other) macro for cleaning date data

Bliss/Ryan,

You could also use worksheet formulas.

IF you actually have the double quote marks in each cell, then try:

=DATEVALUE(SUBSTITUTE(A1,CHAR(34),""))

with the cell formatted for date, then copy down to match.

If you don't actually have the double quotes and were just using them in
your post, you could use

=DATEVALUE(A1)

Then copy the cells with your formulas, and paste special values, then
delete your original column of strings.

HTH,
Bernie
MS Excel MVP


wrote in message
oups.com...
Does anyone have a good macro for taking date data that are in a
variety of formats and making them consistent? By format, I don't mean
that the cells are formatted differently, but that the data are all
recorded as, say, a string, but they all look different, e.g.

"01/05/92"
"01-07-84"
"Jan 12, 1991"
"January 1, 2000"
"10 January '05"

Is there any macro that is written to recognize that, say, the first
two are in mm/dd/yy format and to put them into a consistent style,
that the second, third, and fourth are in different formats, and to
put them into mm/dd/yy, etc.?



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
Cleaning data Torero Excel Worksheet Functions 3 November 28th 06 10:16 PM
Cleaning up data -- any way to globally fix this?? The Moose Excel Discussion (Misc queries) 3 November 26th 06 02:50 PM
Cleaning Data AMMark Excel Discussion (Misc queries) 1 October 19th 06 07:21 PM
Cleaning Up Data [email protected] Excel Discussion (Misc queries) 3 September 20th 06 04:40 PM
Inconsistant Data Cleaning gallegos1580 Excel Discussion (Misc queries) 1 January 10th 05 08:19 PM


All times are GMT +1. The time now is 10:11 PM.

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"