跳到主要內容

 如何返回行或列中的第一個/最後一個非空白單元格?

有時,當您使用工作表時,您可能希望獲取行或列的第一個或最後一個非空白單元格值。 如果在一行或一列中幾乎沒有數據的情況下,一目了然就很容易獲得該值,但是在長列或長行中返回數據將是一項艱鉅的任務。 在這裡,我可以向您介紹一些解決此工作的有用方法。

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

使用公式返回行或列中的最後一個非空白單元格


箭頭藍色右氣泡 使用公式返回行或列中的第一個非空白單元格

要提取數據的第一個單元格,請使用以下公式:

1。 在數據旁邊的空白單元格中輸入以下公式: =INDEX(A1:A13,MATCH(TRUE,INDEX((A1:A13<>0),0),0)),請參見屏幕截圖:

文檔返回第一個數據單元格 1

2。 然後按 Enter 鍵,您將獲得第一個非空白單元格值,如下所示:

文檔返回第一個數據單元格 1

筆記:

1.在上式中 A1:A13 是您要使用的列範圍,您可以根據需要進行更改。 該公式也可用於獲取行中的第一個非空白單元格值,只需將列範圍更改為行範圍即可。

2.此公式僅適用於單行或單列。


箭頭藍色右氣泡 使用公式返回行或列中的最後一個非空白單元格

如果要返回最後一個非空白單元格的值,這是另一個公式,可以幫您一個忙。

1。 輸入此公式 =LOOKUP(2,1/(A1:A13<>""),A1:A13) 除數據之外,將其插入空白單元格,請參見屏幕截圖:

文檔返回第一個數據單元格 1

2。 然後按 Enter 鍵,將立即提取最後一個非空白單元格值。 看截圖:

文檔返回第一個數據單元格 1

筆記:

1.在上式中 A1:A13 是您要使用的列範圍,您可以根據需要進行更改。 該公式也可用於獲取行中的最後一個非空白單元格值,只需將列範圍更改為行範圍即可。

2.以上公式僅適用於單行或單列。

最佳辦公生產力工具

熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

kte選項卡201905


Office選項卡為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