excel - 无需 VBA 查找最后一个非空单元格地址

标签 excel excel-formula vlookup

我需要找到 Excel 电子表格中的最后一个非空单元格,但我需要它的地址,而不是它的值。

例如:当我想要 K 列中最后一个非空单元格的值时,我使用以下公式:

=LOOKUP(2;1/(NOT(ISBLANK(K:K)));K:K)

我的问题是,我不需要单元格的值,我需要它的地址。

我已经尝试使用函数 CELL 但没有成功。

最佳答案

您可以使用MATCH function获取已知列的最后填充的行号。但它有助于了解该列是否填充了数字和/或日期或文本。

=match("zzz"; K:K)   'for last text¹ in column K
=match(1e99; K:K)    'for last date or number in column K

ADDRESS function返回其余部分。

=address(match("zzz"; K:K); 11; 4; 1)  'address of last text¹ in column K
=address(match(1e99; K:K); 11; 4; 1)   'address of last date or number in column K
=address(max(iferror(match(1e99; K:K); 0); iferror(match("zzz"; K:K); 0)); 11; 4; 1)   'address of last date or number or text¹ in column K

4 用于相对寻址(例如 K99); 1 用于 xlA1 寻址。有关 ADDRESS function 的完整语法,请参阅提供的链接。 .

<小时/>

¹ 请注意,“零长度字符串”(例如 "" )通常由错误控制的 MATCH 或 VLOOKUP 返回,被视为文本值,而不是空白或 null值。

关于excel - 无需 VBA 查找最后一个非空单元格地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38268333/

相关文章:

Excel VBA : Select Case if ActiveCell like "*string*"

excel - VLOOKUP 在 VLOOKUP 公式中查找 table_array

excel - 当另一个单元格范围包含随机数量的日期时,计算任务的唯一数量

excel - 对齐两个有间隙的时间序列

excel - VBA VLookUp-不起作用,但没有错误

excel - VLOOKUP 返回空白为 1/0/1990,而不是没有任何可见的内容

excel - 工作表上是否有与 VBA 函数 Cells 等效的函数?

excel - COUNTA 用于包含公式的单元格

excel - 如何将行转换为列,并重复相邻的单元格?

python - 损坏的 Excel 输出 : Openpyxl formula settings?