简体   繁体   中英

Excel formula to extract number from a alphanumeric cell with multiple conditions

I am unable to come up with a formula to add extract only number from "Time"(Kindly refer to the attached Data set) in the picture attached. If I had just string as minutes in my data set I was able to use SUBSTITUTE function to extract number but in the data set I have it usually has Hour or Minutes and I am not able to come up with a formula that does meets the condition below

  • If 'Time' has 'Minutes' remove minutes and display number
  • If 'Time' has 'Hour' in it multiple the number by 60

End result is I do not wish to manually use SUBSTITUTE function by filtering hour and minute separately to add Count + Time.

样本数据集

If there is no further diversity within possible substring:

=A2+IFERROR(SUBSTITUTE(B2," Hour","")*60,SUBSTITUTE(B2," Minutes",""))

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM