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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,230
Messages
6,170,883
Members
452,364
Latest member
springate

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