View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lady Aleena Lady Aleena is offline
external usenet poster
 
Posts: 2
Default Excel 2003 - Help writing a formula to get time (w, d, h, m)

Glenn;

You missed me being an idiot. I realized only after the initial post that I
did NOT want the commas. I will figure out how to remove them, you did a
really great job. Thanks!

LA

"Glenn" wrote:

I think that you will find that my solution handles the plurals and commas
correctly.

Unless I missed something...

Lady_Aleena wrote:
Glenn;

As with Mike H, I really appreciate you stepping in to help me. I really
should have been able to figure this out on my own, but I don't know as much
about Excel as I really should. I just realized that I made it more difficult
with the commas. I was thinking grammatically correct for sentence structure
when writing my initial post. Don't worry about them though. I will figure
out how to get them out.

Mike H and Glenn, have a very nice day!

LA

"Glenn" wrote:

Lady_Aleena wrote:
I have been going around in circles trying to write a formula to get weeks,
days, hours, and minutes.

(e38/h37)/2 is the amount of hours.

The format I would like the output to have is:

X week(s), X day(s), X hour(s), X minute(s)

If one doesn't apply, I would like it to NOT be displayed.

This should be easy, but with all of the rounddowns, mods, etc. plus having
all the text added into all of the if statements to get the plurals right, I
am just frozen.

A1=E38/H37/2


=IF(INT(A1/168),INT(A1/168)&" week"&
IF(INT(A1/168)1,"s","")&IF(MOD(A1,168),", ",""),"")&
IF(INT(MOD(A1,168)/24),INT(MOD(A1,168)/24)&"
day"&IF(INT(MOD(A1,168)/24)1,"s","")&IF(MOD(A1,24),", ",""),"")&
IF(INT(MOD(A1,24)),INT(MOD(A1,24))&"
hour"&IF(INT(MOD(A1,24))1,"s","")&IF(MOD(A1,1),", ",""),"")&
IF(MOD(A1,1),INT(MOD(A1,1)*60)&" minute"&IF(MOD(A1,1)*601,"s",""),"")