Converting string of dates in Excel

  • Thread starter Thread starter QuantumCurt
  • Start date Start date
  • Tags Tags
    Excel String
Click For Summary
The discussion revolves around converting a string of date and time data in Excel into a usable format for plotting. The user is dealing with a large dataset from Fermilab that includes timestamps but is struggling to extract just the time component for the x-axis of a graph. Suggestions include using Excel formulas like =RIGHT(A1,12) to isolate the time, checking cell formatting, and ensuring the correct chart type is selected. Despite attempts, the user encounters issues with the x-axis displaying numerical values instead of the desired time format, indicating a need for proper data handling and formatting techniques. The conversation highlights common challenges faced when manipulating date and time data in Excel.
  • #31
With the text in column A, enter this in B1:
Code:
=DATE(2015,MONTH(DATEVALUE("1 "&MID(A1,5,3))),VALUE(MID(A1,9,2)))+TIMEVALUE(MID(A1,12,8))+VALUE(MID(A1,21,3)/24/60/60/1000)
... and this in C1:
Code:
=VALUE(RIGHT(A1,11))
... and copy the formulas down.

This should work, but you will have to play with the x-axis options a bit: you want to set the "Major unit" to 1.15471e-5 (this is the way Excel stores the value 1 s) and with these data set the "Minimum" to 42167.419247685 (this is the value of 10:03:43 on 12 Jun 2015).

If you don't care about what it displays on the axis, it would be easier to ignore the day and just use
Code:
=TIMEVALUE(MID(A1,12,8))*24*60*60+VALUE(MID(A1,21,3)/1000)
to get values in seconds (to 1/1000 s) past midnight.
 
  • Like
Likes QuantumCurt
Physics news on Phys.org
  • #32
That seems to have worked out very well! Thank you much!
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
28K
  • · Replies 15 ·
Replies
15
Views
2K
Replies
5
Views
3K