简体   繁体   English

Excel 公式从具有多个条件的字母数字单元格中提取数字

[英]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如果我的数据集中只有分钟字符串,我可以使用 SUBSTITUTE function 来提取数字,但在数据集中我通常有小时或分钟,我无法想出满足条件的公式以下

  • If 'Time' has 'Minutes' remove minutes and display number如果“时间”有“分钟”,则删除分钟并显示数字
  • If 'Time' has 'Hour' in it multiple the number by 60如果“时间”中有“小时”,则将数字乘以 60

End result is I do not wish to manually use SUBSTITUTE function by filtering hour and minute separately to add Count + Time.最终结果是我不希望手动使用 SUBSTITUTE function 通过分别过滤小时和分钟来添加计数+时间。

样本数据集

If there is no further diversity within possible substring:如果在可能的 substring 内没有进一步的多样性:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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