[英]In Excel, How do I count the number of blank cells until the next non-blank cell
I have a spreadsheet which resembles the below. 我有一个类似于以下的电子表格。 Column A is my data and Column B is what I am trying to achieve
A列是我的数据,B列是我要实现的目标
A B
+-----------+-----------+
1 | Some text | A1:A3 |
+-----------+-----------+
2 | | |
+-----------+-----------+
3 | | |
+-----------+-----------+
4 | Some text | A4:A8 |
+-----------+-----------+
5 | | |
+-----------+-----------+
6 | | |
+-----------+-----------+
7 | | |
+-----------+-----------+
8 | | |
+-----------+-----------+
9 | Some text | A9:A9 |
+-----------+-----------+
10 | Some text | A10:A10 |
+-----------+-----------+
11 | | |
+-----------+-----------+
12 | | |
+-----------+-----------+
As you can see, Column A just contains empty and non-empty cells (all cells, including empty ones, actually contain a formula). 如您所见,列A仅包含空单元格和非空单元格(所有单元格,包括空单元格,实际上都包含一个公式)。 In column B, I need to return a range starting at the current row and ending at the first non-empty row, but only if Column A of the current row is not blank.
在B列中,我需要返回一个从当前行开始到第一个非空行结束的范围,但前提是当前行的A列不为空。 The returned result is to be used within another function.
返回的结果将在另一个函数中使用。 For example B1 could be COUNTBLANK(A1:A3), although the actual function is not COUNTBLANK, but a custom function
例如,B1可以是COUNTBLANK(A1:A3),尽管实际功能不是COUNTBLANK,而是自定义功能
Is this possible? 这可能吗?
Thanks 谢谢
Please add a letter at the bottom of your "occupied" ColumnA then try, in B1 and copied down: 请在“已占用” ColumnA的底部添加一个字母,然后尝试在B1中复制并向下复制:
=IF(A1="","","A"&ROW()&":A"&ROW()+MATCH("*",A2:A100,0)-1)
Alternative to account for restriction mentioned by OP 解决OP提到的限制的替代方法
=IFERROR(IF(A1="","","A"&ROW()&":A"&ROW()+MATCH("*",A2:A$1048576,0)-1),"A"&ROW()&":A"&ROW())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.