View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default Time convertion based on condition

This formula (looking at G4 as in your example) will convert "day",
"days", "week" or "weeks" into hours as appropriate, or leave G4 as it
is (assuming it to be in hours already):

=IF(ISNUMBER(SEARCH("day",G4)),LEFT(G4,SEARCH("d", G4)-1)*24&"
hours",IF(ISNUMBER(SEARCH("week",G4)),LEFT(G4,SEAR CH("w",G4)-1)*7*24&"
hours",G4))

Put it in a helper cell on row 4, and then copy it down to cover your
range of cells.

Hope this helps.

Pete

On May 28, 9:36*am, Maglez wrote:
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.