I have the following format of data in Excel.
1 hour
5 hours
30 mins
2 hours 30 mins
1 hour 45 mins
I would like to convert this to the following
1
5
0.5
2.5
1.75
Can someone help with this?
If you only have hours and minutes, a few substitutions should do the trick:
=(IF(ISERROR(FIND("hour",A1)),"00:","")&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"s","")," hour", ":00"),":00 ",":")," min",""))*24
Remove the extra s
first, then substitute the hour
by :00
, then substitute :00
with nothing to 'stick' the hours and minutes together, finally remove the min
.
If there is no hour
in the text, prepend 00:
and multiply the whole thing by 24 to convert the time into hours.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.