VB Macro SUM IF

JackRyan82

New Member
Joined
Apr 6, 2018
Messages
3
All, I have a sumifs that I want to convert to VB and i have been struggling for a few days. The SUMIFS is causing issues for my excel document as it integrates with an ERP package. I have identified that the formula, not in VB, is the issue even though it calculates the correct amounts (different issue).

=SUMIFS(Data!X9:X100,Data!O9:O100, 'Capital - Supl'!K1,Data!I9:I100,"5*")

I have no problem getting my SUMIFS to work within the cell however I am struggling to get it crafted in VB. Can someone help me. I am new so forgive any missing information.

Essentially I need to sum the values in column X9:X100 when the values in column O9:O100 matches the value in worksheet Capital - Supl cell K1 where the values in column I9:I100 starts with a 5.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try something like this...

Code:
MyTotal = Evaluate("=SUMIFS(Data!X9:X100,Data!O9:O100, 'Capital - Supl'!K1,Data!I9:I100,""5*"")")
 
Upvote 0
Welcome to the MrExcel board!

Not sure what sheet or what cell(s) you want the formula in, but the gist of it is that you have to double-up on the quote marks when inserting the formula by vba.
So it would be something like this
Rich (BB code):
Range("A2").Formula = "=SUMIFS(Data!X9:X100,Data!O9:O100, 'Capital - Supl'!K1,Data!I9:I100,""5*"")"
 
Last edited:
Upvote 0
Thank you Mr. Excel! I appreciate the warm welcome. This did the trick as well. I appreciate the community here.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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