如何在SumIfs()中使用OR运算符 [英] How to use OR Operator with SumIfs()

查看:1693
本文介绍了如何在SumIfs()中使用OR运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果3个条件(= OR)中有1个匹配,如何使用SumIfs求和?

How do I use SumIfs to sum if 1 out of 3 criteria (=OR) matches?

如何将OR用作条件?这是伪代码.

How can I use OR for the criteria? Here is the pseudocode.

Sub SumDemo()

    Dim Sum

    Sum = Application.WorksheetFunction.SumIfs([REVENUE], [UNIT], "=avengers", [region], "=north OR =south OR = west")

    MsgBox Sum

End Sub

推荐答案

尝试使用Google搜索"VBA excel sumifs Or",您会发现结果#1:

Try googling "VBA excel sumifs Or" and you will find result #1:

VBA-具有Or的SumIfs

Dim Sum as Double
Dim Revenue As Range, Unit As Range, Region As Range

'You will need to define your ranges.
Set Revenue = Range("")
Set Unit ...
Set Region ...

Sum = Application.Sum(Application.SumIfs(Revenue, Regions, Unit, "Avengers", Array("North", "south","west")))

这篇关于如何在SumIfs()中使用OR运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆