简体   繁体   English

EXCEL 计数非连续范围内的非空行

[英]EXCEL count non-empty rows in non-contiguous range

I'm trying to count how many non-empty row I have in a range that is non-contiguous.我正在尝试计算在非连续范围内有多少非空行。 I know it's easy to do if I create additional column that checks if a row is empty and then count that, but I'd like to do all that in a single cell.我知道如果我创建额外的列来检查一行是否为空然后计算它很容易做到,但我想在单个单元格中完成所有这些。 Here's an example table:这是一个示例表: 在此处输入图片说明

So here my ranges would be "A1:C10" ;所以这里我的范围是 "A1:C10" ; "E1:F10" ; "E1:F10" ; "H1:H10" and I want to count the rows that are empty in these ranges. “H1:H10”,我想计算这些范围内的空行数。 (So in this case the answer would be 2: rows "5" and "8") Note that there might be data in column "D" and "G" that I need to disregard in the evaluation. (因此在这种情况下,答案将是 2:行“5”和“8”)请注意,在评估中可能需要忽略“D”和“G”列中的数据。 Also in the real data I have a lot of rows, but the number of ranges (columns)that is need to evaluate at a time are not the much so it is acceptable to enter the ranges in the formula by hand.同样在实际数据中,我有很多行,但是一次需要评估的范围(列)的数量并不多,因此可以手动在公式中输入范围。

I've found this post and tried the formula in the last answer, but as far as I know I can't use non-contiguous range with COUNTBLANK, so I couldn't modify to work for me.我找到了这篇文章并尝试了最后一个答案中的公式,但据我所知,我不能将非连续范围与 COUNTBLANK 一起使用,因此我无法修改为我工作。

I tried this (entering as array formula) but it didn't work:我试过这个(作为数组公式输入)但它没有用:

=SUM(IF(AND((COUNTA(OFFSET(E5,ROW(1:13)-1,0,1,4))=0),(COUNTA(OFFSET(I5,ROW(1:13)-1,0,1,1))=0), (COUNTA(OFFSET(C5,ROW(1:13)-1,0,1,))=0)),0,1))

Does anybody know a good formula or method for this?有没有人知道一个好的公式或方法?

Use MMULT as it is not volatile like OFFSET.使用 MMULT,因为它不像 OFFSET 那样易变。

=SUM(--(MMULT((A2:H11<>"")*(COLUMN(A2:H11)<>4)*(COLUMN(A2:H11)<>7),TRANSPOSE(COLUMN(A2:H11)^0))=0))

Depending on one's version of Excel it may need to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.根据 Excel 的版本,退出编辑模式时可能需要使用 Ctrl-Shift-Enter 而不是 Enter 进行确认。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM