简体   繁体   中英

Excel Index & Match using a Boolean OR with Wildcard

Data:

(Columns A and B)

A B
Apples & Dates £1.20
Oranges £0.50
Pears £3.55
Melons £4.44

I want to do index match on the first column to find cells that contain "Apples" OR "Dates".

When I try this:

=INDEX(A1:B3,MATCH(1,(A1:A3="*"&"apples"&"*")+(A1:A3="*"&"dates"&"*"),0),2)

(I press ctrl-shift-enter to put it as an array) I still get the #N/A problem

What am i missing? (I have tried Xlookup but gives the same problem. If i try and just put a single array in of =(A1:A3="*"&"apples"&"*") it still fails

(A1:A3="*"&"apples"&"*")+(A1:A3="*"&"dates"&"*") If IF worked with wildcards (Hint: It does not) would return 2 not 1 when it hits A1 and therefore it will not find a match.

But if you have XLOOKUP, you have FILTER and FILTER will do what you want:

=@FILTER(B1:B4,(ISNUMBER(SEARCH("Apple",A1:A4)))+(ISNUMBER(SEARCH("Dates",A1:A4))))

在此处输入图像描述

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