VBA-与或的和 [英] VBA - SumIfs with Or

查看:44
本文介绍了VBA-与或的和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处都研究了这个问题,但找不到适合自己情况的答案.

I have researched this issue everywhere, and I can't find an answer to my particular situation.

这是我的SumIfs声明.

Here's my SumIfs statement.

B_white = Application.SumIfs(Range("G84:G" & LastRow), Range("G84:G" & LastRow), "1", Range("K84:K" & LastRow), "B*", Range("L84:L" & LastRow), "2 (test)")

对于最终标准,它需要查找"2(测试)"或仅查找"2",但是我不能使用"2 *",因为其中将包含"22"和"28"的单元格.

For the final criterion, it needs to look for "2 (test)" OR just "2" but I can't use "2*" because there will be cells with "22" and "28" in them.

如何更改此SumIfs语句,使其查找为"2(测试)"或"2"?

How can I alter this SumIfs statement so that it looks for "2 (test)" or "2"?

推荐答案

B_white = Application.Sum(Application.SumIfs(Range("G84:G" & LastRow), Range("G84:G" & LastRow), "1", Range("K84:K" & LastRow), "B*", Range("L84:L" & LastRow), Array("2 (test)", "2")))

这篇关于VBA-与或的和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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