Determine existance of TWO numbers within four cells in one row

cbjexcel

New Member
Joined
Dec 3, 2016
Messages
3
I have a spreadsheet that consists of a series of four contiguous cells in one row that contain the numbers of 1 through 10 exclusively and without duplication (ie. 10, 1, 5, 9 OR 4, 2, 10, 1). I need a formula that determines whether two specified numbers (ie. 1 AND 5) exist within those four cells. If 'yes' return the number 1, if no return the number "0". This formula will be modified to determine other possibly combinations of numbers (ie. 2 AND 10 or 3 AND 4, etc) on other four cells.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Canapone

Active Member
Joined
May 10, 2007
Messages
463
Hi

in E1

=IF(COUNTIF(A1:D1,1)*COUNTIF(A1:D1,5),1,0)

or if F1=1, G1=5

=IF(COUNTIF(A1:D1,F1)*COUNTIF(A1:D1,G1),1,0)

Regards
 
Last edited:

Canapone

Active Member
Joined
May 10, 2007
Messages
463
Hi again

another approach using MATCH.

In A1:D1 the 4 numbers, in F1:G1 numbers to be matched

In E1:

--(COUNT(INDEX(MATCH(F1:G1,A1:D1,0),))-1>0)


Regards
 

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
Here's another one...

Numbers in the range A1:D1

=--(SUM(COUNTIF(A1:D1,{1,5}))=2)
 

cbjexcel

New Member
Joined
Dec 3, 2016
Messages
3
I appreciate your reply :) and your suggestions. I'll try them ;) and see which is the easiest to use. You've made my efforts so much easier.
 

cbjexcel

New Member
Joined
Dec 3, 2016
Messages
3
I've applied your suggestion and its doing exactly what I was hoping for :):). It's going to take some effort on my part to get this plugged in all of the right cells with the right number inquiries but once I've done this it'll self populate all of my data without any problems. THANKS
 

Watch MrExcel Video

Forum statistics

Threads
1,129,553
Messages
5,636,989
Members
416,953
Latest member
broexc

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
Top