If cell contains one word from List A AND one word from list C, return adjacent cell

yits05

Board Regular
Joined
Jul 17, 2020
Messages
56
Office Version
  1. 2016
Platform
  1. Windows
So far I have this formula which does a great job of searching the column 'main column'!O2 for words in 'Keywords $A$1:$A$12' and returning the adjacent cell.

=IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2)))>0,'main column'!Q2," ")

However, I have another list, in Keywords2!$A$1:$A$12, and I would like the formula to only return the adjacent cell (main column'!Q2) if 'main column'!O2 contains a word from 'Keywords $A$1:$A$12' AND Keywords2!$A$1:$A$12


Thank you.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Untested, but you need to add the AND condition by using the multiplication operator (*) something like this:

Code:
=IF(SUMPRODUCT((--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2))>0)*(--ISNUMBER(SEARCH("*"&Keywords2!$A$1:$A$12&"*",'main column'!O2))>0)),'main column'!Q2,"")
 
Upvote 0
Untested, but you need to add the AND condition by using the multiplication operator (*) something like this:

Code:
=IF(SUMPRODUCT((--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2))>0)*(--ISNUMBER(SEARCH("*"&Keywords2!$A$1:$A$12&"*",'main column'!O2))>0)),'main column'!Q2,"")

Thank you, but this seems to return only N/As, even when I know it should be returning proper results. Appreciate any additional help.
 
Upvote 0
Try this, In this way we ensure that there is at least one word in Keywords and in Keywords2.

VBA Code:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2)))>0,
IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords2!$A$1:$A$12&"*",'main column'!O2)))>0,'main column'!Q2," ")," ")

Edit:

Reviewing Joe's formula, it should look like this:
VBA Code:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2)) * --ISNUMBER(SEARCH("*"&Keywords2!$A$1:$A$12&"*",'main column'!O2)) )>0,'main column'!Q2," ")
 
Last edited:
Upvote 0
Try this, In this way we ensure that there is at least one word in Keywords and in Keywords2.

VBA Code:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2)))>0,
IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords2!$A$1:$A$12&"*",'main column'!O2)))>0,'main column'!Q2," ")," ")

Edit:

Reviewing Joe's formula, it should look like this:
VBA Code:
=IF(SUMPRODUCT(--ISNUMBER(SEARCH("*"&Keywords!$A$1:$A$12&"*",'main column'!O2)) * --ISNUMBER(SEARCH("*"&Keywords2!$A$1:$A$12&"*",'main column'!O2)) )>0,'main column'!Q2," ")

Thank you, but I still only get N/As all the way down...
 
Upvote 0
You can put a sample of the three sheets:
main column
Keywords
Keywords2

What is the name of the sheet where the formula is?

To put examples you can use the XL2BB tool:
 
Upvote 0

Forum statistics

Threads
1,214,535
Messages
6,120,093
Members
448,944
Latest member
SarahSomethingExcel100

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