Is there an Excel custom format string that will show seconds in a dd:hh:mm:ss format, but hiding any leading zero values?
E.g., it is straightforward to format 100,000 s in dd:hh:mm:ss as 01:03:46:40. However, for 50,000 seconds I would like to display as hh:mm:ss (i.e. 13:53:20) not as dd:hh:mm:ss (00:13:53:20), using a single formatting string for all values.
It can be achieved using TEXT formulas with something like:
IF(A1<60,
TEXT(A1/86400, "ss"),
IF(A1<3600,
TEXT(A1/86400, "mm\:ss"),
IF(A1<86400,
TEXT(A1/86400, "hh\:mm\:ss"),
TEXT(A1/86400, "d\:hh\:mm\:ss"))))
However this returns all values as text which doesn't allow numerical sorting of the values.
It can also be achieved with conditional formatting, but I'd prefer to use that only if I have to.
I'm hoping someone is going to tell me about the magical custom format string that will do the job!
Dates are stored as days and fractions of a day.
So, no matter what,
50,000in Excel means50,000days. Before you can format it to show the equivalent hrs/mins/sec you must divide it by86,400to transform the value to50,000secondsOnce you have done that, you can use a custom number format:
[<1]hh:mm:ss;dd:hh:mm:ssHowever, you should also be aware the
ddwill only be in the range of1-31. It will roll over back to1at that point. So if your time will encompass more than31days, you will not be able to use a custom number format to accomplish what you want.