If statement to encompass an Array

Excel_77

Active Member
Joined
Sep 15, 2016
Messages
311
Office Version
  1. 2019
Platform
  1. Windows
I have the following statment within my formula and it work as it is, it bascally returns "Yes" if K2 = "Liverpool".

=IF(K2="Liverpool","Yes","No")

However I have a list of 12 names in tab "Lookup" A1-A12 and I want to expand the formula above to also check L2 and if it matches any of the names within the looup then "yes" should be returned -how is this done?

Thanks in advance
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
If I understand you correctly, this should work:
Code:
=IF(OR(COUNTIFS(Lookup!A1:A12,K2)>0,COUNTIFS(Lookup!A1:A12,L2)>0),"Yes","No")
 
Upvote 0
If I understand you correctly, this should work:
Code:
=IF(OR(COUNTIFS(Lookup!A1:A12,K2)>0,COUNTIFS(Lookup!A1:A12,L2)>0),"Yes","No")

So in order to get a "Yes" k2 needs to = "Liverpool" an L2 needs to match one of the names on the list.
 
Upvote 0
With this formula you will get Yes if either K2 or L2 has one of the names in A1:A12 ... that's what I thought you needed
If you need Liverpool in K2 and one of the names from A1:A12 then you need
Code:
=IF(AND(K2="Liverpool",COUNTIFS(Lookup!A1:A12,L2)>0),"Yes","No")
 
Upvote 0
With this formula you will get Yes if either K2 or L2 has one of the names in A1:A12 ... that's what I thought you needed
If you need Liverpool in K2 and one of the names from A1:A12 then you need
Code:
=IF(AND(K2="Liverpool",COUNTIFS(Lookup!A1:A12,L2)>0),"Yes","No")

That worked, thanks so much.
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

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