Ok, I thought I would turn this debacle of mine into maybe a fun discussion. Here was the challenge, a friend of mine wanted to turn a 'total seconds' numerical value into a text string that broke the seconds down into day/hour/minute/second evaluation. The macro would have been a 10 line paradigm of simplicity.....However, he didn't want a macro because of the security warning that people then got with it. He couldn't wrap his mind around a way to do it as a cell formula. He challenged me to do it for a steak dinner. Well, I did it.....but the result is rather embarassing. I used a brute force method with '(U6*K7)' being the total seconds. This post has two functions. First, could someone embarass me more by coming up with a simplier way of doing it. Second, I would love to hear some of your funny stories about stupid things you did (like the formula below) that you never wanted to show anyone.....but worked.
Code:
=IF(K7>0,IF(INT((U6*K7)/86400)>0,INT((U6*K7)/86400)&" Days, ","")&IF(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)>0,INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)&" Hours, ","")&IF(INT(((U6*K7)-(INT((U6*K7)/86400)*86400)-(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)*3600))/60)>0,INT(((U6*K7)-(INT((U6*K7)/86400)*86400)-(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)*3600))/60)&" Minutes, ","")&IF(((U6*K7)-(INT((U6*K7)/86400)*86400)-(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)*3600)-((INT(((U6*K7)-(INT((U6*K7)/86400)*86400)-(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)*3600))/60))*60))>0,((U6*K7)-(INT((U6*K7)/86400)*86400)-(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)*3600)-((INT(((U6*K7)-(INT((U6*K7)/86400)*86400)-(INT(((U6*K7)-(INT((U6*K7)/86400)*86400))/3600)*3600))/60))*60))&" Seconds",""),0)