# countif

#### sullyman4

##### Board Regular

I have done this before but can't find where i put it.

on sheet 1 I have this summary report.
Code:
``````           A       B         C
1   office#  Number Y/N
2      2       formula
3      3       formula
4      4       formula
5      5       formula
6       6      formula``````
The formula in cell B2 needs to look at another sheet (that looks like below sheet) and count the number of "Yes" in the office# that matches cell A2 above. So, for office #2 (A1) how many stores in the spreadsheet below have "Yes" The answer displayed in cell B3 should be 3

Code:
``````       A          B         C       D
]1   Office#  Strore    Open
2    2          as         yes
3    2          zq          no
4    2          we         yes
5    3          le          no
6    3           re         yes
7    3          bm        no
8    3          hi          yes
9    2          hk         yes
10  6          wp          yes``````

I hope this is clear If not shoot me an email or just shoot me

### Excel Facts

Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Something like this:

=SUMPRODUCT((Sheet3!\$A\$2:\$A\$10=A2)*(Sheet3!\$C\$2:\$C\$10="yes"))

This assumes that the other sheet is named Sheet3, and that the data itself begins in A2 on both worksheets.

Worked. Thanks. I was on the right track, sort of

How about placing this in B2, then copy down to B6.

=SUM((officeno=A2)*(yesno="y"))

Use Ctrl+Shift+Enter to enter the formula.

Also, you need to name the second sheet A2:A10 officeno and C2:C10 yesno.

Replies
3
Views
253
Replies
1
Views
126
Replies
12
Views
296
Replies
2
Views
169
Replies
4
Views
190

1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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

### Which adblocker are you using?

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

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