提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何返回行或列中的第一个/最后一个非空白单元格?

在处理工作表时,有时可能需要获取行或列的第一个或最后一个非空白单元格值。 如果一行或一列中的数据很少,那么获取该值很容易,但要以长列或行返回数据将是一件痛苦的任务。 在这里,我可以谈谈解决这项工作的一些有用的方法。

用公式返回行或列中的第一个非空白单元格

用公式返回行或列中的最后一个非空白单元格


将多个工作表,工作簿和csv文件组合到一个工作表/工作簿中:
在日常工作中,将多个工作表或工作簿合并到一个工作表或工作簿中可能是一项巨大而头痛的工作。 但是,如果你有 Kutools for Excel,其强大的功能 - 结合,可以将多个工作表,工作簿快速合并到一个工作表或工作簿中。
doc结合了多个工作表-1

箭头蓝色右泡 用公式返回行或列中的第一个非空白单元格


要用数据提取第一个单元格,请应用以下公式:

1。 除了数据之外,将下列公式输入到空白单元格中: =INDEX(A1:A13,MATCH(TRUE,INDEX((A1:A13<>0),0),0)),看截图:

DOC-返回第一数据细胞1

2。 然后按 输入 键,您将获得第一个非空白单元格值,如下所示:

DOC-返回第一数据细胞1

备注:

1。 在上面的公式中, A1:A13 是您想要使用的列范围,您可以根据需要进行更改。 此公式也可以应用于获取一行中的第一个非空白单元格值,您只需将列范围更改为行范围。

2。 此公式在单行或单列上正确工作。


箭头蓝色右泡 用公式返回行或列中的最后一个非空白单元格

如果你想返回最后的非空白单元格值,这里有另一个公式可以帮你一个忙。

1。 键入此公式 =LOOKUP(2,1/(A1:A13<>""),A1:A13) 进入空白单元格,除了您的数据,请参阅截图:

DOC-返回第一数据细胞1

2。 然后按 输入 键,最后一个非空白单元格值将被立即提取。 看截图:

DOC-返回第一数据细胞1

备注:

1。 在上面的公式中, A1:A13 是您想要使用的列范围,您可以根据需要进行更改。 此公式也可用于获取一行中最后一个非空白单元格值,您只需将列范围更改为行范围。

2。 上述公式在单行或单列上正确工作。


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Guest · 5 months ago
    A1:A13<>0 returns an array of value that are either true or false
    all values that are not 0 (eg <>0) in A1:A13 become true, and all else become false
    So now you can look up the first 'true' in that array and use it to index
  • To post as a guest, your comment is unpublished.
    Matt · 5 months ago
    What does "INDEX((A1:A13<>0)" mean? The first parameter to INDEX is the set of cells A1 through A13 but with a test for not equal to zero appended. I can't find any explanation of this.
  • To post as a guest, your comment is unpublished.
    guest · 6 months ago
    Hi can someone helpme on this,

    I have a csv file or maybe a excel which has n number of data's in it from which i need few collective data's using formulas which should be automatic,and i need the output to be in a table form.can please anyone helpme on this??
  • To post as a guest, your comment is unpublished.
    RaRdEvA · 7 months ago
    I would really love to know why ,1/([RANGE]<>0) works :(
  • To post as a guest, your comment is unpublished.
    Taufiq · 9 months ago
    How To Return The Last Non Blank Cell from some selected cells In A Row
  • To post as a guest, your comment is unpublished.
    Muhd Aiman · 10 months ago
    Doesn't work in Google sheets with Error: Did not find value "2" in lookup evaluation.


    Works well in Ms excel.
    • To post as a guest, your comment is unpublished.
      Ankur · 9 months ago
      Try this in google sheets:


      =INDEX( FILTER( F:F , NOT( ISBLANK( F:F ) ) ) , ROWS( FILTER( F:F , NOT( ISBLANK( F:F ) ) ) ) )
      • To post as a guest, your comment is unpublished.
        amgosto · 8 months ago
        How do I edit the formula to pull the last non-blank cell instead of the first?
  • To post as a guest, your comment is unpublished.
    Claus Adelmann · 1 years ago
    Hi thanks for the formula. How can I extend this formula if I have a table A-N and need to lookup certain value in A first to locate row in which I want to get as a result last non blank value found in column H-L?
  • To post as a guest, your comment is unpublished.
    Sunil Kerody · 1 years ago
    Hi, thanks for the The Last Non Blank Cell In A Row Or Column formula, this is want I was exactly looking for,
    Can you please explain me the logic? (why for lookup_vector vale you have passed 1/(range<>=””))
    Regards,
    SK
  • To post as a guest, your comment is unpublished.
    SK · 1 years ago
    Hi, Thanks for the formula (Return The Last Non Blank Cell In A Row Or Column With Formula - =LOOKUP(2,1/(A1:A13<>""),A1:A13))
    This formula did what i was exactly looking for. just for my understanding, can you please explain the logic?, why 2 is used for lookup value and logic of lookup_vector in formula.
    Thanks in advance

    Regards,
    SK
  • To post as a guest, your comment is unpublished.
    Juan Miguel · 1 years ago
    How can I return the row number of the second non-blank cell? It would help me a lot with my paper.
  • To post as a guest, your comment is unpublished.
    Alliage · 1 years ago
    How to return the row number of the second non-blank cell? Coulld you me?
  • To post as a guest, your comment is unpublished.
    Hassan · 1 years ago
    I need help to get a data from collumn A.
    In Row-1 I've a lot of name. From these I need to look up a name,find out last non zero value of that name column and then find the respected data from Collumn A.

    Can you guyz please help??

    I don't know how to add pictures here.





    • To post as a guest, your comment is unpublished.
      Ken J · 1 years ago
      Use IFERROR(put your function here, "").
    • To post as a guest, your comment is unpublished.
      SGB · 1 years ago
      hi, if the row that you are looking for content is completely empty, it is returning "#N/A". How can I get it to return nothing and leave the cell blank?
  • To post as a guest, your comment is unpublished.
    Me · 1 years ago
    Thank You for posting this!
  • To post as a guest, your comment is unpublished.
    Bob Hungerschafer · 3 years ago
    Using values in a8,b8,c8: 0 8 A8
    Copying this formula to the next to cells on the right
    =ROW(INDEX(A1:A100,MATCH(TRUE,INDEX((A1:A1000),0),0)))
    Yields: 9 8 8

    However copying this formula to the next to cells on the right
    =ROW(INDEX(A1:A100,MATCH(TRUE,INDEX((A1:A100""),0),0)))
    Yields: 8 8 8

    1st non zero is not the same as 1st non blank ergo the 2nd formula yields what was stated in the premise statement: "How to return the first / last non blank cell in a row or column?"
  • To post as a guest, your comment is unpublished.
    ManU · 4 years ago
    Good one! it worked!