简体   繁体   中英

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. 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. I chose the following for 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. If I have "3com" in I3, I get 5 and so on. If I have a value like "Rareton" in I3, I will get 7 (and not 9) since it obtains the first match.

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.

=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.

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