simple countif question

bolo

Active Member
Joined
Mar 23, 2002
Messages
423
Hi All,

I am trying to get a countif array formula to work.

The formula i am try to get looks like
{=countif($A$1:$A$10,B$1:B$10)}

So basically in column b i will have a number of values, and i am basically trying to see if any of the values in column b is found in column a.

So the above formula would return a positive number if a value in b is found in a.

HOwever the formula only seems to work if the matching number is in the top row.

eg
1 ,3
2, 2
4
5
6
7
8
9
10
11

doesn't give the required result.
how can i get this countif array formula to work?

Thanks

Bolo
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi All,

I am trying to get a countif array formula to work.

The formula i am try to get looks like
{=countif($A$1:$A$10,B$1:B$10)}

So basically in column b i will have a number of values, and i am basically trying to see if any of the values in column b is found in column a.

So the above formula would return a positive number if a value in b is found in a.

HOwever the formula only seems to work if the matching number is in the top row.

eg
1 ,3
2, 2
4
5
6
7
8
9
10
11

doesn't give the required result.
how can i get this countif array formula to work?

Thanks

Bolo
=SUMPRODUCT(COUNTIF($A$1:$A$10,B$1:B$10))

counts the occurences of B1:B10 in A1:A10 at once and total them.

If you want to count the occurrences of the items from B1:B10 one by one...

In C1 enter & copy down:

=COUNTIF($A$1:$A$10,B$1)
 
Upvote 0
=SUMPRODUCT(COUNTIF($A$1:$A$10,B$1:B$10))

counts the occurences of B1:B10 in A1:A10 at once and total them.

If you want to count the occurrences of the items from B1:B10 one by one...

In C1 enter & copy down:

=COUNTIF($A$1:$A$10,B$1)

thanks didnt think about using the sumproduct to encompass the whole formula, i thought the array formula wold be sufficient.

regads

Bolo
 
Upvote 0
thanks didnt think about using the sumproduct to encompass the whole formula, i thought the array formula wold be sufficient.

regads

Bolo

You are welcome.

If you replace SumProduct with Sum and confirm the formula with control+shift+enter, again the same effect will obtain.
 
Upvote 0
Hi All,

I am trying to get a countif array formula to work.

The formula i am try to get looks like
{=countif($A$1:$A$10,B$1:B$10)}

So basically in column b i will have a number of values, and i am basically trying to see if any of the values in column b is found in column a.

So the above formula would return a positive number if a value in b is found in a.

HOwever the formula only seems to work if the matching number is in the top row.

eg
1 ,3
2, 2
4
5
6
7
8
9
10
11

doesn't give the required result.
how can i get this countif array formula to work?

Thanks

Bolo
Here's another one...

Book1
AB
121
232
343
464
567
66
77
88
98
1010
Sheet1


=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A10,B1:B5,0))))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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