converting days and hours, mins, and sec

kelbarben

New Member
Joined
Aug 12, 2008
Messages
23
I have a report that generates into excel everyday from our avaya system. But if it is more than 24 hours in a time period, it will show up like this, for example: 2d 18:11:49 For my report and formulas, I need it to be in hours, minutes, seconds, so I have to manually change it to 66:11:49. Is there a formula to write that if it sees something that has the #d, it would know to convert that to hours and add it into what follows it? I hope this makes sense. Thanks.

Kelbarben
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Maybe:

B1: =IF(ISTEXT(A1)=FALSE,A1,LEFT(A1,FIND("d",A1)-1)+SUBSTITUTE(A1,LEFT(A1,FIND(" ",A1&" ")),""))

Where A1 holds your output string and B1 will hold conversion value or original value if numeric (ie no d in string as I'm presuming this is showing as a numerical value as opposed to text)
B1 formatted to be [hh]:mm:ss

If you want excel to change A1 value automatically I think you'd need to run some code for that...
 
Upvote 0
That is wonderful! I would have never figured that out!! Can you also help me add in that formula that if it does not have the d, for example 15:50:15, it converts that into the same type number as your formula did for the ones that had the days in it!! You have just fixed months of struggling for me! Thanks!!

Kelbarben
 
Upvote 0
Given the previous solution didn't work for you when there was no "d" every entry must be "text"... I had presumed that where "d" did not exist Excel would interpret the resulting value as numeric, hence:

=IF(ISTEXT(A1)=FALSE,A1,....)

Given this does not work, try:

=IF(ISNUMBER(SEARCH("d",A1))=FALSE,--A1,LEFT(A1,FIND("d",A1)-1)+SUBSTITUTE(A1,LEFT(A1,FIND(" ",A1&" ")),""))
 
Upvote 0

Forum statistics

Threads
1,215,495
Messages
6,125,149
Members
449,208
Latest member
emmac

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