问题
给出Excel范围内的子字符串列表,例如:
子字符串表
[A1:A3]
Apple
Banana
Carrot
我希望返回这些子字符串中的哪个出现在包含文本的单元格中,例如:
文本单元格
[A5]
The Apple fell from the tree
方法/公式将返回:Apple
原因:
每个月我将导入几百个包含文本并需要分类的单元格。最常见的子字符串将在顶部的子字符串范围内,即导入的文本单元格将具有一个相邻的列,该列具有一个公式,该公式可输出存在的子字符串之一,从而节省了大量的用户时间。所需的输出示例为:
所需的输出
*Table of text cells* | *Output referencing substring table* [A5:B5]
The Apple fell from the tree | Apple
A Carrot grows in the ground | Carrot
There was a bag of rotten Apples | Apple
Watch out for that Orange |
The monkey ate the Banana | Banana
通过修补和研究获得最接近的公式
我得到的最接近的是一个公式,如果存在子字符串(返回1或0),该公式将返回:
=SUMPRODUCT(--ISNUMBER(SEARCH($A$1:$A$3,A5)))
使用此公式和上面的“所需输出”示例,我将看到:
[A5:B5]
The Apple fell from the tree | 1
A Carrot grows in the ground | 1
There was a bag of rotten Apples | 1
Watch out for that Orange | 0
The monkey ate the Banana | 1
在本论坛上推荐此测试为TRUE / FALSE,但我无法适应自己的需求。任何建议,不胜感激:)