Excel查找索引列表中的最大部分值 [英] Excel Find the largest partial value in an indexed list
问题描述
我正在使用excel并尝试查找一个单元格的一部分是否与列表中的任何内容匹配。我试图提取单元格的那部分作为我的结果。
I am working with excel and trying to find if a portion of one cell matches anything from a list. I am attempting to extract that part of the cell as my result.
我正在使用的公式是:
{= INDEX($ A $ 1:$ A $ 10,MATCH(1,COUNTIF(B1,*& $ A $ 1:$ A $ 10&*),0) )}
{=INDEX($A$1:$A$10,MATCH(1,COUNTIF(B1,"* "&$A$1:$A$10&"*"),0))}
注意:不得不将星号用尽以避免斜体
note: had to space out the asterisk to avoid italics
A1到A10是列表我正在引用,B列中的任何内容都是我在列表中搜索的部分内容
A1 to A10 is the list i am referencing and anything in column B is what I am searching partail parts for in the list
问题是公式返回最常见在列表中找到的值而不是列表中最具体的部分。
The problem is the formula return the most common value found in the list instead of the most specific part of the list.
示例:
A(list) B (formula result) (desired Result)
1 ABC sdfjABCsdhfs ABC ABC
2 ABC123 asdfasdfa #N/A #N/A
3 RBZ456 agfhABC1234shj ABC ABC1234
4 ABC1234 wuefhiuvbsiue #N/A #N/A
5 DEF123 dfsghABC123sdf ABC ABC123
B列中的最大结果是我期待找到的结果。不是最低的共同点。
The maximum result found in column B is what I am looking to find as my result. Not the lowest common denominator.
任何建议都会很棒!
提前致谢。
编辑:添加括号,它是一个数组公式
edit: added brackets, it is an array formula
推荐答案
数组公式** :
= INDEX($ A $ 1:$ A $ 10,MATCH(MAX(IF(COUNTIF(B1,*& $ A $ 1:$ A $ 10&*),LEN($ A $ 1:$ A $ 10))),IF (COUNTIF(B1,*& $ A $ 1:$ A $ 10&*),LEN($ A $ 1:$ A $ 10)),0))
=INDEX($A$1:$A$10,MATCH(MAX(IF(COUNTIF(B1," *"&$A$1:$A$10&" *"),LEN($A$1:$A$10))),IF(COUNTIF(B1," *"&$A$1:$A$10&" *"),LEN($A$1:$A$10)),0))
(我还在四个星号中的每一个之前添加了一个空格。)
(I also added a single space before each of the four asterisks.)
问候
**数组公式的输入方式与标准公式的输入方式不同。您只需按住CTRL和SHIFT键,然后按ENTER键,而不是只按ENTER键。如果你已经正确地完成了它,你会注意到Excel在公式周围放置了大括号{}(虽然不要尝试自己手动插入这些)。
这篇关于Excel查找索引列表中的最大部分值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!