跳到主要内容

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

有时,当您使用工作表时,您可能希望获取行或列的第一个或最后一个非空白单元格值。 如果在一行或一列中几乎没有数据的情况下,一目了然,您很容易获得该值,但是在长列或长行中返回数据将是一件痛苦的事情。 在这里,我可以向您介绍一些解决此工作的有用方法。

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

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


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

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

1。 在数据旁边的空白单元格中输入以下公式: =INDEX(A1:A13,MATCH(TRUE,INDEX((A1:A13<>0),0),0)),请参见屏幕截图:

文档返回第一个数据单元格 1

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

文档返回第一个数据单元格 1

笔记:

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

2.此公式仅适用于单行或单列。


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

如果要返回最后一个非空白单元格的值,这是另一个公式,可以帮您一个忙。

1。 输入此公式 =LOOKUP(2,1/(A1:A13<>""),A1:A13) 除数据之外,将其插入空白单元格,请参见屏幕截图:

文档返回第一个数据单元格 1

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

文档返回第一个数据单元格 1

笔记:

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

2.以上公式仅适用于单行或单列。

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (31)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How do i use this formula to return the columns header of the first cell with a value >0 ?
This comment was minimized by the moderator on the site
Hello, Tom,
To solve your problem, please apply the below formula:
=INDEX($B$1:$H$1,MATCH(TRUE,$B2:$H2>0,0))
https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-return-column-headers.png

Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Como faço para obter o menor valor de um intervalo, onde pode haver células em branco ?
This comment was minimized by the moderator on the site
Thank you so much for your content! I don't know what I'm doing wrong but I can't seem to be able to do this (in Google sheets) :

I need to fill H1 with the value from the first non-empty cell from C1 to G1. Then I need to copy this for all next rows (H2, H3, H4 etc)

Thanking you in advance for your time, it would be very appreciated :)
This comment was minimized by the moderator on the site
Hi, Marissa,
If you want to get the first non blank value from a row in Google sheets, please apply any one of the following formulas:

=QUERY(transpose(C1:G1),"Select Col1 where Col1 is not null limit 1",0)
=index(C1:G1,MATCH(FALSE,ISBLANK(C1:G1),0))

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Perfect answer. Have been looking for this for quite some time. Thank you!
This comment was minimized by the moderator on the site
Hi
I want to return the first non blank cell in a row but rather that with
information in top cell of the fist nin blank cell.
This comment was minimized by the moderator on the site
It works to find last non blank cell that has more than 255 characters, also. Helpful for me to solve issue.
Thanks a lot !
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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??
This comment was minimized by the moderator on the site
I would really love to know why ,1/([RANGE]<>0) works :(
This comment was minimized by the moderator on the site
How To Return The Last Non Blank Cell from some selected cells In A Row
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations