SUMPRODUCT limit

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,834
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Is there a limit to the SUMPRODUCT?

This fails:

Code:
Dim LastRow as Integer

LastRow = 1000

Dim a As Variant

With Sheet1

a = Evaluate("=SUMPRODUCT((-1*('" & .Name & "'!AN2:AN" & LastRow & "+'" & .Name & "'!AR2:AR" & LastRow & ")/'" & .Name & "'!H2:H" & LastRow & "/12<=" & wksResults.Range("Monthly").Value & ")*('" & .Name & "'!H2:H" & LastRow & ">" & wksResults.Range("Monthly").Value & ") * ('" & .Name & "'!H2:H" & LastRow & "<=" & wksResults.Range("Monthly").Value & ") *( -1*('" & .Name & "'!AN2:AN" & LastRow & "+'" & .Name & "'!AR2:AR" & LastRow & ")/'" & .Name & "'!H2:H" & LastRow & "/12))")

End With

whereas this works:

Code:
Dim LastRow as Integer

LastRow = 1000

Dim a As Variant

With Sheet1

a = Evaluate("=SUMPRODUCT((-1*(AN2:AN" & LastRow & "+AR2:AR" & LastRow & ")/'" & .Name & "'!H2:H" & LastRow & "/12<=" & wksResults.Range("Monthly").Value & ")*('" & .Name & "'!H2:H" & LastRow & ">" & wksResults.Range("Monthly").Value & ") * ('" & .Name & "'!H2:H" & LastRow & "<=" & wksResults.Range("Monthly").Value & ") *( -1*('" & .Name & "'!AN2:AN" & LastRow & "+'" & .Name & "'!AR2:AR" & LastRow & ")/'" & .Name & "'!H2:H" & LastRow & "/12))")

End With

The difference being the second one has fewer of these:

Code:
'" & .Name & "'!

Thanks
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
No, I can assure you that's not the problem.
 
Last edited:
Upvote 0
There is a 255 character limit to the formula string you can pass to Evaluate. Perhaps you're hitting that. You'd be better off using Sheet1.Evaluate as it will evaluate the formula in the context of that sheet so you don't have to qualify all those addresses.
 
Upvote 0
Thanks.

My alternative was to write Sheet1.Select or Sheet1.Activate but I'd rather not do that.
 
Upvote 0
Not to answer for Rory, but you don't have to activate it...you just have to specify it, like he said. Sheet1.Evaluate
 
Upvote 0
Yup - and it's generally faster than Application.Evaluate too. :)
 
Upvote 0

Forum statistics

Threads
1,215,501
Messages
6,125,169
Members
449,212
Latest member
kenmaldonado

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