Check if column contains text from matrix

mark5544

New Member
Joined
Apr 10, 2018
Messages
7
Hi, I need help with this, I am stuck.

I have this formula:
=IF(AF2<>0;IF(AND(ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"P"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"Q"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"R"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"S"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"T"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"U"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"V"&AF2);Indata!P2));ISNUMBER(SEARCH(INDIRECT("'"&"Bestseller spec"&"'!"&"W"&AF2);Indata!P2)));"Yes";"No");"No")

I want to see if cell AF2 has value larger than 0, then I want to check if cell P2 contains text strings from another table in sheet Bestseller spec, seen below. Which row that should be used from the table is determined by number in AF2.
k LMNO P Q R S T U VW
model 1Equipment row 1Equipment row 1Equipment row 1Equipment row 1Equipment row 1Equipment row 1Equipment row 1Equipment row 1
model 2Equipment row 2Equipment row 2Equipment row 2Equipment row 2Equipment row 2Equipment row 2Equipment row 2Equipment row 2
model 3Equipment row 3Equipment row 3Equipment row 3Equipment row 3Equipment row 3Equipment row 3Equipment row 3Equipment row 3
model 4
model 5etc
model 6etc
model 7
model 8
model 9
model 10
model 11
model 12
model 13
model 14
model 15
model 16
model 17
model 18
model 19
model 20
model 21

<tbody>
</tbody>

I cant get the formula to work, any ideas someone? All help is much appreciated!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Looks complicated! Is the text in P2 an exact match for one of those cells or just a partial match? Exact match could be coded to a much smaller formula :)

Anyway, if you want to see if it's in *any* of those cells, I think you need OR() rather than AND() as the latter will mandate that it's in *all* those cells.

WBD
 
Upvote 0
Looks complicated! Is the text in P2 an exact match for one of those cells or just a partial match? Exact match could be coded to a much smaller formula :)

Anyway, if you want to see if it's in *any* of those cells, I think you need OR() rather than AND() as the latter will mandate that it's in *all* those cells.

WBD

It will not be an exact match. Example: Text in P2 can look something like "banana, apple, orange, lemon". Lets say AF2 value is 5. In row 5 in the matrix it will be "banana", "apple", and the rest of the line commas "," "," "," "," ","). So P2 contains word banana, apple, and commas, so it should be a match.

RQSTUVW
model 1
model 2
model 3
model 4
model 5bananaapple,,,,,

<colgroup><col width="64" span="8" style="width:48pt"> </colgroup><tbody>
</tbody>

Forgot to mention this detail, P2 will always contain commas (,) which is used for the cells in the matrix that are empty.
 
Upvote 0
OK. Still not 100% clear on the requirements. Here's what I have in the "Bestseller spec" sheet:


Book1
OPQRSTUVW
1model 1apple,,,,banana,,
2model 2,orange,,,,kiwi,
3model 3,,lemon,,,,lime
4model 4,,,pear,,,,
5model 5bananaappleorangelemon,,,,
Bestseller spec


Here's my "Indata" sheet:


Book1
PAFAG
2banana, apple, orange, lemon, , , ,5Yes
Indata
Cell Formulas
RangeFormula
AG2=IF(AF2>0,IF(AND(ISNUMBER(SEARCH(INDEX('Bestseller spec'!P:P,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!Q:Q,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!R:R,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!S:S,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!T:T,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!U:U,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!V:V,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!W:W,AF2),Indata!P2))),"Yes","No"),"No")


I'm in the UK so I had to swap ";" for "," in the formula but it's giving a "Yes" for row 5. Is that right?

WBD
 
Upvote 0
OK. Still not 100% clear on the requirements. Here's what I have in the "Bestseller spec" sheet:

OPQRSTUVW
1model 1apple,,,,banana,,
2model 2,orange,,,,kiwi,
3model 3,,lemon,,,,lime
4model 4,,,pear,,,,
5model 5bananaappleorangelemon,,,,

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Bestseller spec



Here's my "Indata" sheet:

PAFAG
2banana, apple, orange, lemon, , , ,5Yes

<colgroup><col style="width: 25pxpx"><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Indata

Worksheet Formulas
CellFormula
AG2=IF(AF2>0,IF(AND(ISNUMBER(SEARCH(INDEX('Bestseller spec'!P:P,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!Q:Q,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!R:R,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!S:S,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!T:T,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!U:U,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!V:V,AF2),Indata!P2)),ISNUMBER(SEARCH(INDEX('Bestseller spec'!W:W,AF2),Indata!P2))),"Yes","No"),"No")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



I'm in the UK so I had to swap ";" for "," in the formula but it's giving a "Yes" for row 5. Is that right?

WBD

Yes that did it thank you very much!
 
Upvote 0

Forum statistics

Threads
1,217,103
Messages
6,134,623
Members
449,879
Latest member
Berry1904

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