View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Maglez Maglez is offline
external usenet poster
 
Posts: 3
Default Time convertion based on condition

Guys, I am impressed for the number of answers, quality and the speed you
guys answered, it seems like a competition :-)

Thank you very much to all of you... I finally when for Rick's solution for
being shorter.

Miguel.

"Rick Rothstein (MVP - VB)" wrote:

I think this normally entered formula does what you want...

=IF(ISNUMBER(SEARCH("week*",A1)),168*LEFT(A1,FIND( " ",A1))&"
hours",IF(ISNUMBER(SEARCH("day*",A1)),24*LEFT(A1,F IND(" ",A1))&" hours",A1))

Rick


"Maglez" wrote in message
...
Hello.

How can I inspect cells which contain data like...
2 weeks
1 day
3.2 hours

and convert them all to hours as...
336 hours
24 hours
3.2 hours

I have been playing with the conditional IF and the text command SEARCH...

=IF(SEARCH("days",G4),1,0)

...but I am able only to perform 1 condition, I don't know if there is a
better approach to do this.