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.

[TABLE="class: grid, width: 50"]
<TBODY>[TR]
[TD]Gender
[/TD]
[TD]Years Of Service
[/TD]
[/TR]
[TR]
[TD]m
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]m
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]m
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]m
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]f
[/TD]
[TD]2
[/TD]
[/TR]
[TR]
[TD]f
[/TD]
[TD]3
[/TD]
[/TR]
[TR]
[TD]f
[/TD]
[TD]4
[/TD]
[/TR]
[TR]
[TD]f
[/TD]
[TD]5
[/TD]
[/TR]
[TR]
[TD]m
[/TD]
[TD]2
[/TD]
[/TR]
</TBODY>[/TABLE]
 
Last edited:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,358
Messages
6,171,625
Members
452,412
Latest member
thomasleysen531

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