Calculate average in multiple sheets with multiple conditions - Sumproduct calculations take too long

Shanaya2009

New Member
Joined
Mar 11, 2021
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I need help with an alternative formula instead of SUMPRODUCT.

I have over 30 sheets (for every co-worker) with a lot of data. In every sheet column A has dates (from 1st to 31th of the month, each date has multiple entries) and column H has values in %.
I have another sheet (Total) that calculates averages per day for all co-workers and monthly average for all co-workers.
To get the right result, I need to calculate average from all % in column H that have the same date in all sheets.

I have SUMPRODUCT formulas, combined with INDIRECT, but every time I change something anywhere, those formulas calculate and this takes sooooo long.
I have tried with marcos Worksheet.Activate + manual calculation and then in every sheet activesheet.calculate to prevent long calculations, but it still takes too long, and it also disables copy/paste, so this is not an option.

Does anyone have a solution to replace my formula with something else?
I need to calculate the average of all data in column H in every sheet, if column A in every sheet equals to A3 in Total (same date), if column B in every sheet doesn't have the value "x" and if column C in every sheet is not empty.

=SUMPRODUCT(SUMIFS(INDIRECT("'"&SHEETS&"'!H:H");INDIRECT("'"&SHEETS&"'!A:A");A3;INDIRECT("'"&SHEETS&"'!B:B");"<>x";INDIRECT("'"&SHEETS&"'!C:C");"<>"))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&SHEETS&"'!A:A");A3;INDIRECT("'"&SHEETS&"'!B:B");"<>x";INDIRECT("'"&SHEETS&"'!C:C");"<>"))

Thanks in advance.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

The biggest problem with your formula, is that you are using whole columns, you should limit the range to more realistic size like
Excel Formula:
=SUMPRODUCT(SUMIFS(INDIRECT("'"&SHEETS&"'!H2:H1000");INDIRECT("'"&SHEETS&"'!A2:A1000");A3;INDIRECT("'"&SHEETS&"'!B2:B1000");"<>x";INDIRECT("'"&SHEETS&"'!C2:C1000");"<>"))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&SHEETS&"'!A2:A1000");A3;INDIRECT("'"&SHEETS&"'!B2:B1000");"<>x";INDIRECT("'"&SHEETS&"'!C2:C1000");"<>"))
 
Upvote 0
Solution
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

The biggest problem with your formula, is that you are using whole columns, you should limit the range to more realistic size like
Excel Formula:
=SUMPRODUCT(SUMIFS(INDIRECT("'"&SHEETS&"'!H2:H1000");INDIRECT("'"&SHEETS&"'!A2:A1000");A3;INDIRECT("'"&SHEETS&"'!B2:B1000");"<>x";INDIRECT("'"&SHEETS&"'!C2:C1000");"<>"))/SUMPRODUCT(COUNTIFS(INDIRECT("'"&SHEETS&"'!A2:A1000");A3;INDIRECT("'"&SHEETS&"'!B2:B1000");"<>x";INDIRECT("'"&SHEETS&"'!C2:C1000");"<>"))

Thanks for the tip about my settings.

And mostly, thanks for your help. Such a simple solution, that actually works (y)
(why didn't I think of that :unsure:)
 
Upvote 0
Glad to help. Thanks for the feedback & updating your profile.
 
Upvote 0

Forum statistics

Threads
1,214,838
Messages
6,121,885
Members
449,057
Latest member
Moo4247

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