# Count rows where specified values appear in specified columns

I currently have a worksheet with sample data:

``````   |     A     |     B     |     C     |
---------------------------------------
1  | SHAPE     | SIDES     | COLOUR    |
---------------------------------------
2  | Rectangle | 4         | Blue      |
---------------------------------------
3  | Rectangle | 4         | Orange    |
---------------------------------------
4  | Rectangle | 4         | Red       |
---------------------------------------
5  | Square    | 4         | Blue      |
---------------------------------------
6  | Square    | 4         | Orange    |
---------------------------------------
7  | Square    | 4         | Red       |
---------------------------------------
8  | Triangle  | 3         | Blue      |
---------------------------------------
9  | Triangle  | 3         | Orange    |
---------------------------------------
``````

In sheet 2 I am using a formula to count the rows of each colour (by matching the cell value):

``````   |     A     |     B     |
---------------------------
1  | COLOUR    | TOTAL     |
---------------------------
2  | Blue      | 3         |
---------------------------
3  | Orange    | 3         |
---------------------------
4  | Red       | 2         |
---------------------------
``````

Formula in Cell B2:

``````=COUNTIF('Sheet 1'!\$C\$1:\$C\$1000,A2)
``````

Formula in Cell B3:

``````=COUNTIF('Sheet 1'!\$C\$1:\$C\$1000,A3)
``````

Formula in Cell B4:

``````=COUNTIF('Sheet 1'!\$C\$1:\$C\$1000,A4)
``````

I would now like to count colour types with specific number of sides (e.g., Orange shapes with four sides). I am getting stuck on how to achieve this.

• Look into COUNTIFS(). – Bandersnatch Jan 11 '18 at 15:21
• `COUNTIFS` is probably what you want.  If you find a solution, please post it as an answer.  If it doesn’t work for you, please edit your question (do not respond in comments) to show what you tried, what results you got, and an example of what results you want. – G-Man Jan 11 '18 at 22:21

For 4 SIDES: `=COUNTIFS(Sheet1!\$C:\$C,\$A2,Sheet1!\$B:\$B,"4")`
For 3 SIDES: `=COUNTIFS(Sheet1!\$C:\$C,\$A2,Sheet1!\$B:\$B,"3")` 