Countif/Sumproduct - Multiple Worksheets/3 Criteria

mdotbdot

New Member
Joined
Feb 17, 2010
Messages
2
Hello

I am trying to get a count of rows which meet 3 criteria, across multiple tabs.

On a single worksheet, the formula (x)

=SUMPRODUCT((B:B<=4)*(B:B>=1)*(A:A="m"))

gives the expected result "4". However, when this table appears on multiple sheets, I tried (y)

=SUMPRODUCT(COUNTIF(INDIRECT("'"&Sheetlist&"'!B:B"),"<=4")*(COUNTIF(INDIRECT("'"&Sheetlist&"'!B:B"),">=1")*(COUNTIF(INDIRECT("'"&Sheetlist&"'!A:A"),"M"))))

where Sheetlist! is a named range listing all tabs. The resulting calculation is much larger than expected - it appears to calculate each tab multiple times. The Formula (z)

=SUMPRODUCT(COUNTIF(INDIRECT("'"&Sheetlist&"'!A:A"),"M"))

gives expected results for a single criterion, but for three something goes wrong. My logic was to replace the expressions in formula (x) with variations on (z) for each criteria to get (y) but that is not the solution. Any advice on this one? The workbook has 272 tabs. Simplified data table is below.

FYI I modified these formulas from threads on Mr. Excel msg board, so thanks for getting me this far.

P.S. This is my first post.

Gender
Years Of Service
m
2
m
3
m
4
m
5
f
2
f
3
f
4
f
5
m
2

<TBODY>
</TBODY>
 
Last edited:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
P.S. I'm using Excel 2010.

Although a late response, the following would suit your set up:
Rich (BB code):
=SUMPRODUCT(
    COUNTIFS(
      INDIRECT("'"&SheetList&"'!B:B"),">=1",
      INDIRECT("'"&SheetList&"'!B:B"),"<=4",
      INDIRECT("'"&SheetList&"'!A:A"),"M"))
 
Upvote 0

Forum statistics

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