Time between date/time

JWSafe

New Member
Joined
Dec 13, 2023
Messages
10
Office Version
  1. 365
Platform
  1. MacOS
Hi There,
I can't work this out!
this is the data set I am working with and it's basic testing times for each test.
I'm try to work out the time difference between each test.
I think I'm struggling with formatting.

The main issue I'm having is when I'm Text to Columns it's converting the 'pm' times from 1pm to am.

Help is appreciated.
 

Attachments

  • Screenshot 2024-02-15 at 2.51.59 pm.png
    Screenshot 2024-02-15 at 2.51.59 pm.png
    74.7 KB · Views: 17

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
what does the data in column B look like before you use Text To Columns?
Have you considered using a formula to convert the text to the time value?
 
Upvote 0
Hey, this is what it looks like before I do text to columns.
 

Attachments

  • Screenshot 2024-02-16 at 8.33.37 am.png
    Screenshot 2024-02-16 at 8.33.37 am.png
    26 KB · Views: 6
Upvote 0
do you know if this is 12:32 AM or 12:32 PM. Is all of your data the same time? How are times after 1:00 PM displayed?
Nevermind I didnt see the bottom records

Parse out the time component with this.
Excel Formula:
=TIMEVALUE(TEXTAFTER(A2," "))
then custom format the cell as hh:mm or hh:mm:ss
 
Last edited:
Upvote 0
Yer that's the issue after 1pm it converts it to am time
 
Upvote 0
Yer that's the issue after 1pm it converts it to am time
this is what I get:
(I created the date time text in column A for ease).
Book1
AB
1format hh:mm or hh:mm:ss
22024-02-14 00:09:4300:09
32024-02-14 02:36:2202:36
42024-02-14 03:08:4603:08
52024-02-14 03:40:4203:40
62024-02-14 04:32:0104:32
72024-02-14 08:20:4908:20
82024-02-14 08:54:4808:54
92024-02-14 09:25:1809:25
102024-02-14 11:53:4811:53
112024-02-14 12:18:0112:18
122024-02-14 13:21:3213:21
132024-02-14 15:31:4315:31
142024-02-14 15:52:4115:52
152024-02-14 17:44:5117:44
162024-02-14 18:08:2618:08
172024-02-14 21:13:5921:13
182024-02-14 23:34:5323:34
192024-02-14 23:41:4323:41
202024-02-14 23:42:2123:42
212024-02-14 23:57:3323:57
Sheet3
Cell Formulas
RangeFormula
B2:B21B2=TIMEVALUE(TEXTAFTER(A2," "))
 
Upvote 0
Row 36 as example before and after
 

Attachments

  • Screenshot 2024-02-16 at 8.40.58 am.png
    Screenshot 2024-02-16 at 8.40.58 am.png
    52.1 KB · Views: 5
  • Screenshot 2024-02-16 at 8.41.40 am.png
    Screenshot 2024-02-16 at 8.41.40 am.png
    43.7 KB · Views: 4
Upvote 0
nah didn't work?
 

Attachments

  • Screenshot 2024-02-16 at 9.02.15 am.png
    Screenshot 2024-02-16 at 9.02.15 am.png
    12.8 KB · Views: 7
Upvote 0
then you have messy data that needs to be cleaned up
I cant see what you data looks like because of the yellow triangle. If you copied this from a web page or imported it somehow, you have non printing or zero length characters.
try this and see if it still displays the date and time text correctly:
Excel Formula:
=LEFT(A2,LEN(A2)-1)


But, did it work for most of the records? It seems like it did. But, if you're doing time arithmetic, I suggest you use 24 hour display and not AM/PM. it always confuses me.
 
Upvote 0
@JWSafe what do you get with
Excel Formula:
=TIMEVALUE(TEXTAFTER(TEXT(A2,"dd/m/yyyy hh:mm")," "))
or just
Excel Formula:
=TIMEVALUE(TEXT(A2,"dd/m/yyyy hh:mm"))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,066
Members
449,090
Latest member
fragment

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top