开发者

How do you add two COUNTIF equations together?

How do i add two COUN开发者_运维百科TIF equations together to get a total


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"))


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

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


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.


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.


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")


=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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜