View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
wabbleknee wabbleknee is offline
external usenet poster
 
Posts: 31
Default separating date and time

Tx again Claus.... I have a solution that works thanks to you!
The data comes to me in the mm/dd/yyyy format (April 3, 2013) so I was able
to change that around.
I notice however that the macro format matches my data! :-)
My work project is to identify peak work load by day of week and hour of
each day using the time stamps in question.

Mike

"Claus Busch" wrote in message ...

Hi again,

Am Wed, 24 Apr 2013 17:23:14 -0400 schrieb wabbleknee:

A3 = 04/03/2013 01:45:00 PM
A3 is selected, TextToColumns
Delimited is selected
Selected data shows 4/3/2013 01:45:00 PM
Next, , All Delimiters are not selected (blank)
data preview = 4/3/2013 01:45:00 PM
Next, general format, destination B1
B1 = 4/3/2013 13:45 in same cell
The fx(function) window shows 4/3/2013 1:45:00 PM


first use custon format for the cells:
dd/mm/yyyy hh:mm
Then click in column header to select the column = TextToColumns =
Delimited = Delimiter is Blank = Format for the first colum is Date
d/m/y, format for the second cell is "General" = Destination is A3 (if
your values begin in A3) = Finish
If you now have in column A a date with time 00:00 format the column for
date.
Or try this macro:

Sub SeparateData()
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
With Range("A1:A" & LRow)
.NumberFormat = "mm\/dd\/yyyy hh:mm"
.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, _
Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 3), Array(2, 1)), TrailingMinusNumbers:=True
.NumberFormat = "mm\/dd\/yyyy"
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2