Need to lighten the calculation load ... help?

Sven62

Active Member
Joined
Feb 21, 2012
Messages
485
The following code occurs 231 times each on six sheets. That's 1386 calculations for every new entry.

Anyone have a great idea for speeding this up?

Code:
=SUMPRODUCT(--(OVERTIME!$B$4:$B$2048>=DATA!D$2),--(OVERTIME!$B$4:$B$2048<=DATA!D$3),--(OVERTIME!$K$4:$K$2048="Monday"),--(OVERTIME!$D$4:$D$2048=TRUE),--(OVERTIME!$C$4:$C$2048=1),OVERTIME!$G$4:$G$2048)
+SUMPRODUCT(--(OVERTIME!$B$4:$B$2048>=DATA!D$2),--(OVERTIME!$B$4:$B$2048<=DATA!D$3),--(OVERTIME!$K$4:$K$2048="Monday"),--(OVERTIME!$D$4:$D$2048=TRUE),--(OVERTIME!$C$4:$C$2048=1),OVERTIME!$H$4:$H$2048)
+SUMPRODUCT(--(OVERTIME!$B$4:$B$2048>=DATA!D$2),--(OVERTIME!$B$4:$B$2048<=DATA!D$3),--(OVERTIME!$K$4:$K$2048="Monday"),--(OVERTIME!$D$4:$D$2048=TRUE),--(OVERTIME!$C$4:$C$2048=1),OVERTIME!$I$4:$I$2048)
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
yes what excel do you have? IF 2007 or later try
=SUMIFS(OVERTIME!$G$4:2048,OVERTIME!$B$4:$B$2048,"<="&DATA!D$3,OVERTIME!$k$4:$k$2048,"MONDAY",OVERTIME!$D$4:$D$2048,"TRUE",OVERTIME!$C$4:$C$2048,1)
 
Last edited:
Upvote 0
The following code occurs 231 times each on six sheets. That's 1386 calculations for every new entry.

Anyone have a great idea for speeding this up?

Code:
=SUMPRODUCT(
  --(OVERTIME!$B$4:$B$2048>=DATA!D$2),
  --(OVERTIME!$B$4:$B$2048<=DATA!D$3),
  --(OVERTIME!$K$4:$K$2048="Monday"),
  --(OVERTIME!$D$4:$D$2048=TRUE),
  --(OVERTIME!$C$4:$C$2048=1),
  OVERTIME!$G$4:$G$2048)
+
SUMPRODUCT(
  --(OVERTIME!$B$4:$B$2048>=DATA!D$2),
  --(OVERTIME!$B$4:$B$2048<=DATA!D$3),
  --(OVERTIME!$K$4:$K$2048="Monday"),
  --(OVERTIME!$D$4:$D$2048=TRUE),
  --(OVERTIME!$C$4:$C$2048=1),
  OVERTIME!$H$4:$H$2048)
+
SUMPRODUCT(
  --(OVERTIME!$B$4:$B$2048>=DATA!D$2),
  --(OVERTIME!$B$4:$B$2048<=DATA!D$3),
  --(OVERTIME!$K$4:$K$2048="Monday"),
  --(OVERTIME!$D$4:$D$2048=TRUE),
  --(OVERTIME!$C$4:$C$2048=1),
  OVERTIME!$I$4:$I$2048)

Try to switch a more appriate formula:
Control+shift+enter, not just enter:
Rich (BB code):
=SUM(
  IF(OVERTIME!$B$4:$B$2048>=DATA!D$2,
  IF(OVERTIME!$B$4:$B$2048<=DATA!D$3,
  IF(OVERTIME!$K$4:$K$2048="Monday",
  IF(OVERTIME!$D$4:$D$2048,
  IF(OVERTIME!$C$4:$C$2048=1,
   OVERTIME!$G$4:$I$2048))))))

If still short on performance, let's concatenate:

Overtime, L4, just enter, and copy down:
Rich (BB code):
=C4&"|"&D4+0&"|"&K4

Now invoke, control+shift+enter, not just enter:
Rich (BB code):
=SUM(
  IF(OVERTIME!$B$4:$B$2048>=DATA!D$2,
  IF(OVERTIME!$B$4:$B$2048<=DATA!D$3,
  IF(OVERTIME!$L$4:$L$2048=1&"|"&1&"Monday"
   OVERTIME!$G$4:$I$2048))))
 
Upvote 0
BTW how do I format my code on separate lines as you have done? Carriage return does not work!
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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