计数最后一个单元格和下一个非空白单元格之间的空白单元格数 [英] Count number of blank cells in row between last cell and next non-blank cell
问题描述
是否可能(最好使用公式)计算行中空白单元格的数量,其中计数从给定列开始计数并向后计数(例如从右到左)空白单元数,直到非空白找到单元格?在下面的例子中,计数从H列开始向左移动。使用 COUNTA
或 COUNTIF
看起来像合理的工具使用,但我不确定如何终止计数一次非-blank单元格。
如果表中的值都是文本,您可以使用这样的东西:
= COUNTBLANK(INDIRECT(CHAR(97 + MATCH(zzzz,B2:H2))& ROW()& :H& ROW()))
MATCH(zzzz ,B2:H2)
返回最后一个非空白单元格的列号。
CHAR(97 +列号)
返回该列的字母。
将其附加到行号以给出参考,其中 COUNTBLANK
必须以& ROW()开头
&:H& ROW())
给出最后一个单元格的引用,它是 H
加行号。
INDIRECT
将连接的文本转换为Excel可以评估的范围。 >
Is it possible (with a formula preferably) to count the number of blank cells in row, where the counting starts at a given column and counts going backward (e.g. right to left) the number of blank cells until a non-blank cell is found? In the example below, the counting begins at Column H and proceeds leftward. Using COUNTA
or COUNTIF
seem like reasonable tools to use, but I am unsure on how to terminate the counting once a non-blank cell is found.
You can use something like this if the values in your table are all text:
=COUNTBLANK(INDIRECT(CHAR(97+MATCH("zzzz",B2:H2))&ROW()&":H"&ROW()))
MATCH("zzzz",B2:H2)
returns the column number in which the last non-blank cell is.
CHAR(97+ column number)
returns the letter of that column.
Append it to the row number to give the reference where the COUNTBLANK
has to start with &ROW()
&":H"&ROW())
gives the reference of the last cell, which is H
plus the row number.
INDIRECT
turns the concatenated text into a range that Excel can evaluate.
这篇关于计数最后一个单元格和下一个非空白单元格之间的空白单元格数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!