简体   繁体   English

需要帮助以使此Index Match Countif公式在Excel中工作

[英]Need help getting this Index Match Countif formula to work in Excel

I built my initial formulas based off of the top answer here . 我根据此处的最佳答案建立了初始公式。 The following is the example formula a user gave. 以下是用户提供的示例公式。

=INDEX($B$2:$B$6,MATCH(1,COUNTIF(I3,"*"&$A$2:$A$6&"*"),0))

This, modified to my data, only give "#N/A" and I'm seeing that the Match function alone gives the "#N/A" if I use a table like the user suggests, but not if I use their first formula that has the data built into the formula. 修改为我的数据后,仅给出“#N / A”,并且我看到,如果我按照用户的建议使用表,则Match函数将单独给出“#N / A”,但是如果我使用他们的第一个在公式中内置了数据的公式。 I see that the comment on his answer says something about it, but I don't know how to apply it. 我看到他的回答中有一些评论,但我不知道该如何应用。

Thanks! 谢谢!

While the question is somewhat open to interpretation, it appears you have a list in A2:A6 which have some values (perhaps characters) and some translations in B2:B6. 尽管这个问题有些开放,但似乎您在A2:A6中有一个列表,其中有一些值(可能是字符),在B2:B6中有一些翻译。 I chose the following for A2:B6 我为A2:B6选择了以下内容

house   2
bridge  4
3       5
ton     7
are     9

If I3 contains "houseboat" and I enter your formula as an array I will get a "2" as a result because "houseboat" has "house" in it. 如果I3包含“ houseboat”,并且我将您的公式输入为数组,则结果将为“ 2”,因为“ houseboat”中包含“ house”。 If I have "3com" in I3, I get 5 and so on. 如果I3中有“ 3com”,则得到5,依此类推。 If I have a value like "Rareton" in I3, I will get 7 (and not 9) since it obtains the first match. 如果我在I3中有一个类似“ Rareton”的值,我将得到7(而不是9),因为它获得了第一个匹配项。

Not a big difference, but I thought I would offer this alternative for looking up partial strings since it uses the FIND function rather than COUNTIF to find the partial strings. 差别不大,但我想我会提供此替代方法来查找部分字符串,因为它使用FIND函数而不是COUNTIF查找部分字符串。

=INDEX($B$2:$B$6,MATCH(TRUE,ISNUMBER(FIND($A$2:$A$6,I3,1)),0))

This is also an array formula (using [Ctrl]+[Shift]+[Enter] rather than [Enter] alone) and is a couple of characters longer than the one you have. 这也是一个数组公式(单独使用[Ctrl] + [Shift] + [Enter],而不是[Enter]),并且比您的字符长几个字符。

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

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