VBA SUMIFS with OR criteria

Akbarov

Active Member
Joined
Jun 30, 2018
Messages
347
Office Version
  1. 365
Platform
  1. Windows
Hello community,

I need help to add 1 more criteria for following SUMIFS but can't figure out how to do that. And there is no any similar question on the internet.
Criteria I want to add:
if wks.Range("K:K"), {"Cash Reload","Cash","Reload"}

VBA Code:
                            Profit = WorksheetFunction.SumIfs(wks.Range("K:K"), wks.Range("C:C"), ws.Cells(x, 9 + i).Value, _
                            wks.Range("F:F"), ">=" & firstDate, _
                            wks.Range("F:F"), "<=" & secondDate)

Hope someone can help me to figure out.
Thanks
 

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.
if wks.Range("K:K"), {"Cash Reload","Cash","Reload"}
But column K, according to the code, is the range of values.
In which column do you have this data:"Cash Reload","Cash","Reload"?

Could you put a sample of your data and what is the result you expect.
 
Upvote 0
Hello Dante thanks for the reply. But I want to add that criteria to my SUMIFS
So, it will sum either if K:K contains either :"Cash Reload" or "Cash" or "Reload"
 
Upvote 0
I am sorry Dante, that was mistake, it is actually L:L which contains: "Cash Reload" or "Cash" or "Reload"
 
Upvote 0
Found solution, if someone will need:
VBA Code:
                                Profit = Application.Sum(Application.SumIfs(wks.Range("K:K") _
                                , wks.Range("C:C"), ws.Cells(x, 9 + i).Value, _
                                wks.Range("F:F"), ">=" & firstDate, _
                                wks.Range("F:F"), "<=" & secondDate, _
                                wks.Range("L:L"), Array("Cash Reload", "Cash")))
 
Upvote 0

Forum statistics

Threads
1,215,081
Messages
6,123,016
Members
449,093
Latest member
ikke

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