Counting with 2 criteria

groundcontrol

New Member
Joined
Feb 7, 2005
Messages
3
I need to count the number of cells that satisfy two criteria. I.e. that are both x (listed in column "A") and y (listed in column "B"). So I've tried various combinations of COUNTIF and AND, to no avail.

For example: COUNTIF(AND((A1:A100,"x"),(B1:B100,"y")))

Any help/pointers greatly appreciated!
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
The COUNTIF function won't work with multiple conditions. Some people like to use a SUMPRODUCT function. I like the SUM function. Try this:

=SUM(IF(A1:A100 = "x",IF(B1:B100="y", 1,0))

As this is an array formula, you need to press CTRL+ALT+ENTER for it to work.

How it works:

It looks at A1 and B1...if A1=x AND B1 = y...it adds 1. If not, it adds 0. It does this over and over again until A100 and B100. It counts the number of rows that countain both x in column A and y in column B. Let me know if this helps.
 
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,676
Members
448,977
Latest member
moonlight6

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