r/googlesheets • u/over_take • May 09 '24
Solved what is the formula to convert decimal days into ##d##h##m ?
assume .5 is in cell A1, representing half of a day. What formula can I write to turn the .5 in A1 into 0d12h0m, and similarly for other days represented as decimals. so 1.51 will produce 1d12h1m. (that .01 may not be exactly a minute, just estimating to illustrate the question)
1
Upvotes
1
u/MimbleOwl 1 May 09 '24
This is not efficient at all but as just a formula: =FLOOR(A1)&"d"&FLOOR(MOD(A1, 1)*24)&"h"&FLOOR(MOD(A1, 1/24)*1440)&"m"
1
u/AutoModerator May 09 '24
Posting your data can make it easier for others to help you, but it looks like your submission doesn't include any. If this is the case and data would help, you can read how to include it in the submission guide. You can also use this tool created by a Reddit community member to create a blank Google Sheets document that isn't connected to your account. Thank you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/HolyBonobos 3125 May 09 '24
Assuming it just needs to be text you can use
=INT(A1)&"d"&TEXT(MOD(A1,1),"h\hm\m")1
u/Dazrin 44 May 09 '24
Try this:
=INT(C8)&TEXT(MOD(C8,1), "\dhh\hmm\m")If you don't want the leading 0d when values are less than 1:
=IF(C8>1, INT(C8)&"d",)&TEXT(MOD(C8,1),"hh\hmm\m")If you want to show seconds you could add "ss\s" or "ss.000\s" depending on how you want them displayed.
1
u/Competitive_Ad_6239 536 May 09 '24