Array search by criteria to return found criteria

GoofyShan

New Member
Joined
Oct 11, 2018
Messages
4
I feel like I'm halfway to what I'm needing. Here's what I'm starting with:


A
B
C
D
E
F
1
Description




word list
2
The zookeeper was reading a book about a dog, bear and fish.
TRUE



aardvark
3
The girl has a cat.
TRUE



bear
4
The boy is allergic to dogs and cats.
TRUE



cat
5
The aardvark's closest relative is an elephant.
TRUE



dog
6
The animal presentation was at a library.
FALSE



elephant
7





fish

<tbody>
</tbody>

$A is the text that I'm searching by $F criteria. $B return is from this formula:

=OR(ISNUMBER(SEARCH({"aardvark";"bear";"cat";"dog";"elephant";"fish"},A2)))

IF it is possible, what I would like is for the return of:

C2 dog, bear, fish
C3 cat
C4 dog, cat
C5 aardvark, elephant
C6 <blank>

Thanks in advance!!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Put this array formula in G2 and drag it across for as many options as you'll have in column F. So if there are six options, as in your example, drag it from G2 until L2, and then drag it down.

Code:
{=IFERROR(INDEX($F$1:$F$6,SMALL(IF(ISERROR(SEARCH($F$1:$F$6,$A2)),1E+99,1)*(ROW($F$1:$F$6)),COLUMN(A$1))),"")}

Remember to confirm it with CTRL+SHIFT+ENTER

The only thing with this formula is that it will return the items in the order of the original list in column F, NOT in the order in which they appear. So, for example, for the first sentence it will return bear, dog, fish - as opposed to dog, bear, fish.
 
Last edited:
Upvote 0
I had to go with the following to get the FISH included:

{=IFERROR(INDEX($F$1:$F$7,SMALL(IF(ISERROR(SEARCH($F$1:$F$7,$A2)),1E+99,1)*(ROW($F$1:$F$7)),COLUMN(A$1))),"")}

Thank you so much!!
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,760
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top