Formula speed required.

Craig1

Active Member
Joined
Jun 11, 2009
Messages
322
Hi All,
I have a sumproduct formula and because I want it to check the whole column it takes quite a while to update.
The formula is:-

=SUMPRODUCT(--(L$L$11:$L$62056="Black"),--($A$11:$A$62056>=$G$44),--($A$11:$A$62056<=$H$44))

Instead of the 62056 rows, is there a quicker way of looking at the column to the end of the data, the data may only be 2 rows down so it doesn't need to look all the way down or up.

Craig.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
1. Why have you used the number 62,056 in the formula?

2. Is there some sort of maximum you could estimate for the number of rows of data? Even if you could say no more than 5,000 rows that would help.

3. What version of Excel are you using?
 
Upvote 0
Hi Craig
Have you considered putting it in a macro to dynamically select the last row ??
Which column does the SUMPRODUCT formula reside in ??
 
Upvote 0
Hi guys,
Thanks for the quick replies.

Peter -
1, I used 62,056 because that was the actual number when I scrolled down to the bottom of the page, nothing more and nothing less.
2, It's a new database and will grow very quickly, in a trial we were up to 1250 rows in a month, so the setting of 5,000 would be quickly reached.
3, At work I use excel 2003 and at home i use 2007 but the database is for work so it will have to be 2003.

Michael -
No I haven't considered a macro but more than willing to learn. The columns vary depending what it is looking at but the example I posted was in column L & A.

Craig.
 
Upvote 0
Sorry Michael I misread your post, the sumproduct formula resides in column A in another woksheet in the same workbook.

Craig.
 
Upvote 0
1. And do you have a lot of those SUMPRODUCT formulas? I found that even with 60,000+ rows of data the formula calculated quite quickly.

2. Have you considered setting Calculation to Manual (Tools|Options...|Calculation tab) and then just calculate the sheet manually when you need to?
 
Upvote 0
Hi Peter,
33 sumproducts along with a lot of VBA. The workbook is 5.3MB.
And yes I already update manually.

Craig.
 
Upvote 0
Or try
Code:
Sub fastsum()
Dim lr As Long, r As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
lr = Cells(Rows.Count, "L").End(xlUp).Row
    For r = lr To 11 Step -1
        If Range("L" & r).Value <> "" Then
            Range("M" & r).Formula = "=SUMPRODUCT(--(L$11:$L$" & lr & "=""Black""),--($A$11:$A$" & lr & ">=$G$44),--($A$11:$A$" & lr & "<=$H$44))"
        End If
    Next r
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
 
Upvote 0
Hi All,
I have a sumproduct formula and because I want it to check the whole column it takes quite a while to update.
The formula is:-

=SUMPRODUCT(--(L$L$11:$L$62056="Black"),--($A$11:$A$62056>=$G$44),--($A$11:$A$62056<=$H$44))

Instead of the 62056 rows, is there a quicker way of looking at the column to the end of the data, the data may only be 2 rows down so it doesn't need to look all the way down or up.

Craig.
You can use dynamic named ranges.


Assuming:
  • Col L contains text
  • Col A contains numbers (or dates?) only
  • data is entered as a contiguous block
Create the named ranges:
  • Goto the menu Insert>Name>Define
  • Name: Dates
  • Refers to: =$A$11:INDEX($A$11:$A$65536,MATCH(1E100,$A$11:$A$65536))
  • Name: Color
  • Refers to: =$L$11:INDEX($L$11:$L$65536,MATCH(1E100,$A$11:$A$65536))
Then the formula becomes:

=SUMPRODUCT(--(Color="Black"),--(Dates>=$G$44),--(Dates<=$H$44))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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