[英]Count sum of non-empty cells in a column when corresponding row in an adjacent column holds specific value - VBA or formula?
Currently, I have a range ( A1:M22
) where for each column ( A
through M
) I count the number of non-empty cells at row 23.目前,我有一个范围(
A1:M22
),对于每一列( A
到M
),我计算第 23 行的非空单元格的数量。
I am using the COUNTBLANK
function.我正在使用
COUNTBLANK
function。 However, not all rows are to be included in the total count at row 23 in each column.但是,并非所有行都包含在每列第 23 行的总数中。
Thus, I have added column N
, where for each row I have indicated whether the specific row should be included in the count or not.因此,我添加了
N
列,对于每一行,我都指出了特定行是否应包含在计数中。 The sheet looks like this:工作表如下所示:
As indicated in column N
, Person 4, Person 7 and Person 15 are not to be counted in the total of employees with a salary even though they appear in the overview.如第
N
列所示,第 4 人、第 7 人和第 15 人即使出现在概览中,也不计入有薪员工总数。 This is due to the fact that perform a task that isn't relevant for the total baseline.这是因为执行与总基线无关的任务。
Taking the month of February for an example, the count should be 10 instead of 12, since Person 4 and Person 7 had a salary that month but shouldn't be included in the total.以 2 月份为例,计数应该是 10 而不是 12,因为第 4 个人和第 7 个人当月有薪水,但不应计入总数。
My question is then, how do I account for this when calculating the count of employees with a salary for each month?那么我的问题是,在计算每个月有薪员工的数量时,我该如何解释这一点? Is it possible to do by an elaborate formula or is VBA the better choice?
是否可以通过精心设计的公式来完成,还是 VBA 是更好的选择?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.