仅计算特定列中的空白

时间:2017-09-27 12:40:14

标签: excel vba excel-vba

我有一个包含A列到X列的电子表格。我想通过计算空白数来审核是否输入。 COUNTBLANK需要一个范围,但我必须填写必须填写的列和非强制性的列。我尝试过以下公式:

=COUNTIF((A2, B2, F2, G2, H2, I2, J2, M2, N2, R2, S2, T2, V2, W2), "")但是我收到#VALUE错误。

2 个答案:

答案 0 :(得分:2)

你很亲密:

=(A2="")+(B2="")+(F2="")+(G2="")+(H2="")+(I2="")+(J2="")+(M2="")+(N2="")+(R2="")+(S2="")+(T2="")+(V2="")+(W2="")

答案 1 :(得分:2)

尝试

=SUM(COUNTIF(INDIRECT({"A2","B2","F2","G2","H2","I2","J2","M2","N2","R2","S2","T2","V2","W2"}),""))

=SUM(COUNTIF(INDIRECT({"A2:B2","F2:J2","M2:N2","R2:T2","V2:W2"}),""))

注意: INDIRECT是一个易失性函数。有关易失性函数的详细信息,请参阅this