Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Count if two criteria match - EXCEL formula

I have this table and I would like to create a formula which would count values based on true conditions from column A and column C.

Example: If in column A value is M (male), and in column C is YES, then it would count.

could anyone help me with this formula?

table

like image 640
Boco Avatar asked Apr 15 '12 00:04

Boco


People also ask

Can you Countif 2 conditions?

You can use the COUNTIFS function in Excel to count cells in a single range with a single condition as well as in multiple ranges with multiple conditions. If the latter, only those cells that meet all of the specified conditions are counted.

Can you add 2 Countifs together?

If there are more than two criteria that you want to count in one column, just use =COUNTIF(range1, criteria1) + COUNTIF(range2, criteria2) + COUNTIF(range3, criteria3)+…

Can I use if and Countif together in Excel?

The COUNTIF function allows you to construct a small IF formula that carries out plenty of logical expressions. Combining the IF and COUNTIF functions also let you have more than 254 logical expressions and the effort to type the formula is minimal.


2 Answers

Add the sheet name infront of the cell, e.g.:

=COUNTIFS(stock!A:A,"M",stock!C:C,"Yes") 

Assumes the sheet name is "stock"

like image 92
pawan bhurtel Avatar answered Sep 20 '22 02:09

pawan bhurtel


If youR data was in A1:C100 then:

Excel - all versions

=SUMPRODUCT(--(A1:A100="M"),--(C1:C100="Yes"))

Excel - 2007 onwards

=COUNTIFS(A1:A100,"M",C1:C100,"Yes")

like image 23
brettdj Avatar answered Sep 20 '22 02:09

brettdj