Converting d h m to hours

Brambles74

New Member
Joined
Aug 27, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
=SUM(MID(0&A2&"000",FIND({"d","h","m"},0&A2&"xxdhm")-2,2)*{1440,60,1})/60

This equation only works for up to 99 days - how do i change it to handle 100 plus days

109d 23h 5m to hours?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Maybe
Excel Formula:
=LET(myD,A2,DD,TEXTBEFORE(myD,"d",,1,0,0),HH,RIGHT(TEXTBEFORE(myD,"h",,1,0,"000"),2),MM,RIGHT(TEXTBEFORE(myD,"m",,1,0,"000"),2),DD*24+HH+MM/60)
 
Upvote 0
Hi, welcome to the forum, here's another option you can try:

Book1
AB
1
21d24
399d2376
499d 1m2376.02
51h 1d25
65h 1m5.01667
71d 1m 5h29.0167
850m 3d72.8333
91m0.01667
Sheet1
Cell Formulas
RangeFormula
B2:B9B2=SUM(EXPAND(TEXTSPLIT(A2,{"d","h","m"},,1),,3,0)*SORTBY({1440,60,1}/60,FIND({"d","h","m"},A2&"dhm")))
 
Upvote 0
Many thanks to both Anthony and FormR. Both formula work and learned myself. Kind regards
 
Upvote 0

Forum statistics

Threads
1,224,120
Messages
6,176,495
Members
452,733
Latest member
Gao87

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