Megan
Megan

Reputation: 31

How do you add two COUNTIF equations together?

How do i add two COUNTIF equations together to get a total

Upvotes: 1

Views: 79938

Answers (6)

Khalil
Khalil

Reputation: 225

=SUMPRODUCT(COUNTIF(A:A,{"Text1","text2","text3","text"}))

You can extend this by adding more csv and it will add up the count of all values if exist in column A. Change the range according to your requirement.

Upvotes: 0

Punniya Kumar
Punniya Kumar

Reputation: 13

If you count particular value, you can use COUNTIF function, Example,

A           B

0-5         A
6-10        B
11-15       C
0-5         D
16-20       E
21-25       D
0-5         A
21-25       D

=COUNTIF(A1:A8,"0-5")

If you count Multiple function,

=COUNTIFS(A1:A8,"0-5",B1:B8,"A")

Upvotes: 0

Tim
Tim

Reputation: 1

If you want to add the count of two different occurences in one column or row...for example:

How often did customers call my store looking for either flour or sugar, where flour and sugar are typed into the cell.

Here is the formula:

=SUM((COUNTIF([Cell Range],"flour")),(COUNTIF([Cell Range],"sugar")))

The cell range can also be an entire column (that's what I did). I just clicked on the column when it asked for range.

Upvotes: 0

Yorgos
Yorgos

Reputation: 30465

Working on Andy Pope's example (if this is what you want):

=COUNTIFS(A11:A13,"a",B11:B13,"b")

Upvotes: 2

Craig
Craig

Reputation: 558

Combining this with your other question, do you mean?

=(COUNTIF(B3:L3,"X")*20)+(COUNTIF(N3:O3,"X")*2.5)

That would add 20 for every X between B3 and L3 and 2.5 for every X in N3 or O3.

Upvotes: 1

Andy Pope
Andy Pope

Reputation: 141

I assume you only want to count when the list contains both items in the same position. Example

A1: =a B1: =a

A2: =a B2: =b

A3: =a B3: =c

COUNTIF(A1:A3,"a") returns 3

COUNTIF(B1:B3,"b") returns 1

to count where first list =a and second list =b you can use SUMPRODUCT, which would return 1.

SUMPRODUCT((A1:A3="a")*(B1:B3="b"))

Or you could use an array formula. You need to use CTRL+SHIFT+ENTER when commiting the formula rather than a simple ENTER. This will automatically add { } around the formula.

=SUM((A1:A3="a")*(B1:B3="b"))

Upvotes: 2

Related Questions