Count with multiple criteria vba

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
I have a data set like this:

Range is B2:J16

With col E and H excluded.
Code:
|col A|Col B |Col C |Col D |Col E |Col F |Col G |Col H |Col I |Col J|
|  x  | B   |     B   |     G   |          |    G   |     I    |           |    A  |   A    |
|  y  | A   |     A   |     E   |          |    D   |     D    |           |    F  |   F    |
|  z  | I   |     I   |     F   |          |    A   |     A    |           |    C  |   C    |

|  x  | H   |     C   |     C   |          |    B   |     H    |           |    D  |   D    |
|  y  | B   |     D   |     H   |          |    E   |     E    |           |    F  |   A    |
|  z  | I   |     B   |     G   |          |    G   |     D    |           |    C  |   C    |

|  x  | A   |     A   |     E   |          |    D   |     D    |           |    F  |   F    |
|  y  | I   |     I   |     G   |          |    A   |     A    |           |    C  |   C    |
|  z  | H   |     C   |     C   |          |    B   |     H    |           |    D  |   D    |

|  x  | I   |     D   |     H   |          |    E   |     E    |           |    B  |   A    |
|  y  | B   |     B   |     G   |          |    G   |     I    |           |    C  |   C    |
|  z  | A   |     A   |     E   |          |    D   |     D    |           |    F  |   F    |

|  x  | I   |     I   |     G   |          |    A   |     A    |           |    C  |   C    |
|  y  | H   |     C   |     C   |          |    B   |     H    |           |    D  |   D    |
|  z  | B   |     D   |     H   |          |    E   |     E    |           |    F  |   A    |

And I want to count say all "A" which belong to an "x" in col A. Then all "A" for "y" through to "z" .

Then I repeat that for "B" to "I".

The output show have this format. By filling it with the
Code:
|NAME |# of   X |# of  Y  |# of Z    |
| A   |         |         |          |
| B   |         |         |          |
| C   |         |         |          |
| D   |         |         |          |
| E   |         |         |          |
| F   |         |         |          |
| G   |         |         |          |
| H   |         |         |          |
| I   |         |         |          |
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Formula is:

Code:
=SUMPRODUCT(($A$2:$A$16=RIGHT(O$1,1))*($B$2:$J$16=$N2))

As Picture:

PL2KREe.jpg
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top