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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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:
Upvote 0
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
 
Upvote 0
Here's another one...

Numbers in the range A1:D1

=--(SUM(COUNTIF(A1:D1,{1,5}))=2)
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

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