Get time More than 24 Hours correctly

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,616
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I have data as below, formula works fine except for greater or equal to 24 hours

How to get correct time if it is greater or equal to 24 hours

Book1
ABC
1Time Tracked TextTime
24 h 15 m4:15:00
315 m0:15:00
415 m0:15:00
53 h 30 m3:30:00
62 h 15 m2:15:00
745 h 21:00:00
844 h20:00:00
925 h1:00:00
1024 h0:00:00
11
12
Sheet1
Cell Formulas
RangeFormula
B2:B10B2=IF(ISNUMBER(SEARCH("h",A2)),TIMEVALUE(SUBSTITUTE(SUBSTITUTE(A2," h",":")," m",":00")),TIMEVALUE("00:"&SUBSTITUTE(A2," m",":00")))
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
May be something like this,
Book1
AB
1Time Tracked TextTime
24 h 15 m4:15:00
315 m0:15:00
415 m0:15:00
53 h 30 m3:30:00
62 h 15 m2:15:00
745 h45:00:00
844 h44:00:00
925 h25:00:00
1024 h24:00:00
Sheet4
Cell Formulas
RangeFormula
B2:B10B2=IF(ISNUMBER(SEARCH("h",A2)),TEXT(LEFT(A2,FIND(" h",A2)-1)/24 + IF(ISNUMBER(SEARCH("m",A2)), MID(A2,FIND("h",A2)+2,FIND(" m",A2)-FIND("h",A2)-2)/1440, 0), "[h]:mm:ss"),IF(ISNUMBER(SEARCH("m",A2)),TEXT(LEFT(A2,FIND(" m",A2)-1)/1440, "[h]:mm:ss")," "))
 
Upvote 0
Try using double negation instead of TIMEVALUE and custom-formatting the cell as [h]:mm:ss
Excel Formula:
=IF(ISNUMBER(SEARCH("h",A2)),--(SUBSTITUTE(SUBSTITUTE(A2," h",":")," m",":00")),--("00:"&SUBSTITUTE(A2," m",":00")))
 
Upvote 0
Another option:
Excel Formula:
=--TEXTJOIN(":",,TEXTSPLIT(A2,{"h","m","s"},,1))
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,226,460
Messages
6,191,165
Members
453,643
Latest member
adamb83

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