Reputation: 25
I have just started using SUMIFS
in vba and I need to check multiple conditions. It should check if something matches either of these AA, AT, AB, AC, AN, AR, AD
I have this code so far which works for only one condition.
WorksheetFunction.SumIfs(TotQty, Style, CellVal, TotQty, ">0", Location, "AA")
Any idea how to adjust it to search for all other options?
Upvotes: 0
Views: 347
Reputation: 11702
Well you can do something like:
MsgBox [Sum(SumIfs(TotQty, Style, CellVal, TotQty, ">0", Location, {"AA","AT","AB","AC","AN","AR","AD"}))]
or
MsgBox Evaluate("=SUM(SumIfs(TotQty, Style, CellVal, TotQty, "">0"", Location, {""AA"",""AT"",""AB"",""AC"",""AN"",""AR"",""AD""}))")
Upvotes: 1