SUMIFS in VBA

ARUNCHENNAI

Board Regular
Joined
Apr 24, 2017
Messages
66
Can some one explain, point the error & provide correct code.
The below code is getting the result
Code:
.Range("P2:p" & lr).Formula = "=SUMIFS(L:L,I:I,O2,M:M,$P$1)"
But the below code is just summing up only the value of O2
Code:
.Range("P2:P" & lr) = WorksheetFunction.SumIfs(.Range("L:L"), .Range("I:I"), .Range(O2), .Range("L:L"), "=RAxle")

Regards
Arun
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
That's not good, sorry. I saw something that looked out of placed.
Could you take a look at the formula:
.Range("P2:p" & lr).Formula = "=SUMIFS(L:L,I:I,O2,M:M,$P$1)"
In that previous instance you had range(O2) in the second formula. As I look at the above formula, your first, I see$P$1. Should "O2", being an absolute point of reference be written as $O$2? That's my last chance to troubleshoot.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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