countif with and

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

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,119,144
Messages
5,576,322
Members
412,716
Latest member
thviid
Top