countif with and

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
sufianmalik said:
Anyone know how to count only if two items are satisfied?

Always exemplify what you need...

Taken up generally, one way:

=SUMPRODUCT(--(RangeX=CondX),--(RangeY=CondY))

would represent a multiconditional count with "=" as the relational test.
 

sufianmalik

Board Regular
Joined
May 7, 2002
Messages
122
Thanks

The example was:

Column A contains A, B, C , D

Column B, contains just Y and N

I want to count all the A's that are also Y's

How would i fit that in?
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
Re: Thanks

sufianmalik said:
The example was:

Column A contains A, B, C , D

Column B, contains just Y and N

I want to count all the A's that are also Y's

How would i fit that in?

=SUMPRODUCT(--($A$2:$A$100="A"),--($B$2:$B$100="Y"))
 

ivory

New Member
Joined
Dec 2, 2005
Messages
13

ADVERTISEMENT

i'm curious to what the "--" is for in that formula =SUMPRODUCT(--($A$2:$A$100="A"),--($B$2:$B$100="Y"))
 

jeromy

New Member
Joined
Dec 23, 2005
Messages
1
Using the sum formula and entering as an array / CSE function would work as well. Enter the function and hold control+shift+enter.

http://www.cpearson.com/excel/array.htm

=SUM(($A$2:$A$100="A")*($B$2:$B$100="Y"))

The signifigance of the dashes is as they coerce the values from bool to numeric (T/F to 1/0).

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

I know the argument of the sumproduct is an array, but I think the array function is easier to look at and comprehend its intent. Different strokes. Both get you the same answer.

Jeromy
 

Watch MrExcel Video

Forum statistics

Threads
1,122,589
Messages
5,597,053
Members
414,118
Latest member
moversnpackers

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