ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I count sets of cells in two columns? (https://www.excelbanter.com/excel-worksheet-functions/196980-how-do-i-count-sets-cells-two-columns.html)

David

How do I count sets of cells in two columns?
 
1 2
a 4
b 2
a 4
c 3
b 4

For the above example, I would like a formula that can count how many times
"a" appears in column 1 with "4" in column 2 of the same row. The output for
this example should be 2

robzrob

How do I count sets of cells in two columns?
 
On Jul 30, 10:04*pm, David wrote:
1 * 2
a * 4
b * 2
a * 4
c * 3
b * 4

For the above example, I would like a formula that can count how many times
"a" appears in column 1 with "4" in column 2 of the same row. *The output for
this example should be 2


In column C: =A1&B1, copy down. Then in any cell, assuming 5 rows:
=COUNTIF(C1:C5,"=a4") - but there's probably a more elegant way!
Watch below...

T. Valko

How do I count sets of cells in two columns?
 
Try this:

=SUMPRODUCT(--(A1:A5="a"),--(B1:B5=4))


--
Biff
Microsoft Excel MVP


"David" wrote in message
...
1 2
a 4
b 2
a 4
c 3
b 4

For the above example, I would like a formula that can count how many
times
"a" appears in column 1 with "4" in column 2 of the same row. The output
for
this example should be 2





All times are GMT +1. The time now is 07:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com