Use VBA to speed up formula

Viking88

Board Regular
Joined
Apr 18, 2003
Messages
103
Is there a way VBA can be used to speed up this formula:

=SUM(IF((Info!$F$1:$F$65000=$A8)*(INfo!$N$1:$N$65000<=D$6)*(Info!$N$1:$N$65000>B$6),(Info!$I$1:$I$65000)))

The reason for this is that on my spreadsheet this formula is dragged through cells b8 through bg32 and eats up a lot of time in calculating the results.

Any suggestions are welcome.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Why do you have that MASSIVE range defined in there? Try limiting the range to fit your data.

Also, native excel formulas will be faster than VBA. But alas, array-evaluated formulas are inheritantly slow.

What version of Excel do you use?
 
Upvote 0
The range of data actuall goes to 62,000 rows so I just used the entire column to make sure I pick up all the data month after month.

I am currently using Excel 2007.
 
Upvote 0
Try a SUMIFs formula instead, it should evaluate MUCH faster

=SUMIFS(Info!$I:$I,Info!$F:$F,$A8,Info!$N:$N,"<="&D$6,Info!$N:$N,">"&B$6)
 
Upvote 0
Thanks I didn't even know the SUMIFS was in 2007.

No problem - thanks for the feedback.

SUMIFS and COUNTIFS was added in Excel 2007, which can use entire column references and also evaluates significantly faster than a SUMPRODUCT or SUM(IF()) formula.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,910
Members
452,949
Latest member
beartooth91

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