MichaelNitsuj
New Member
- Joined
- Jan 18, 2011
- Messages
- 3
I want to find a way to change a string to usable date and time values so that I can run time series analyis on them. I have extracted printing records, each with "timestamps" from poster printers, but the data is unusable as it is. What I get is a string(well, thousands of them, in a column) like this:
20110308185235
which translates to:
yyyy mm dd hh mm ss
or:
2011 03/08 18:52:35
What I need are separate columns with date and time in usable formats. The year and seconds are irrelevent. I've used LEFT, RIGHT, LEFT/LEN, RIGHT/LEN to separate th data into columns of numbers and copied the values to a new column (formated as text so as not to lose any zeros). Built in date and time functions are no good. When I use them, they either do nothing at all to the numbers, or they translate the numbers to completely different numbers ("0301" to 8/1/2737 19:00) even when I use short date formats. Same thing with time: all I can get is 12:00 am for all values, or else nothing at all. I've tried making custom number formats, but that does nothing at all. I've tried recording a macro for changing the values, for example, "1120" to "11/20" but everything I do ends up not doing anything at all to the numbers, or else will do what I want, but outputs the same string as the first value I used for every value. One of many failed Examples:
Sub DateFormat()
'
' DateFormat Macro
'
' Keyboard Shortcut: Ctrl+D
'
Range("B2").Select
ActiveCell.FormulaR1C1 = "03/01"
Range("B2").Select
End Sub
If I use the shortcut on another cell, it applies the formula "03/01" as it was in the first cell, even if I change what cell is in the code.
If there is a way to insert "/" between characters for the date column, and ":" for the time column, or if there is any other way to transform a string like:
"20110308185235" to separate columns like: "03/08," and "18:52," consistently and accurately to thousands of entries, that I can duplicate monthly for time-based analysis of prints (like how many each hour, each day, which hours/days are busier, etc) I'd really appreciate it.
20110308185235
which translates to:
yyyy mm dd hh mm ss
or:
2011 03/08 18:52:35
What I need are separate columns with date and time in usable formats. The year and seconds are irrelevent. I've used LEFT, RIGHT, LEFT/LEN, RIGHT/LEN to separate th data into columns of numbers and copied the values to a new column (formated as text so as not to lose any zeros). Built in date and time functions are no good. When I use them, they either do nothing at all to the numbers, or they translate the numbers to completely different numbers ("0301" to 8/1/2737 19:00) even when I use short date formats. Same thing with time: all I can get is 12:00 am for all values, or else nothing at all. I've tried making custom number formats, but that does nothing at all. I've tried recording a macro for changing the values, for example, "1120" to "11/20" but everything I do ends up not doing anything at all to the numbers, or else will do what I want, but outputs the same string as the first value I used for every value. One of many failed Examples:
Sub DateFormat()
'
' DateFormat Macro
'
' Keyboard Shortcut: Ctrl+D
'
Range("B2").Select
ActiveCell.FormulaR1C1 = "03/01"
Range("B2").Select
End Sub
If I use the shortcut on another cell, it applies the formula "03/01" as it was in the first cell, even if I change what cell is in the code.
If there is a way to insert "/" between characters for the date column, and ":" for the time column, or if there is any other way to transform a string like:
"20110308185235" to separate columns like: "03/08," and "18:52," consistently and accurately to thousands of entries, that I can duplicate monthly for time-based analysis of prints (like how many each hour, each day, which hours/days are busier, etc) I'd really appreciate it.