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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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