Skip to main content

 How to return the first / last non blank cell in a row or column?

When you work with a worksheet, sometimes, you may want to get the first or last non blank cell value of a row or column. It is easy for you to get the value if there are few data in a row or column at a glance, but to return the data in a long column or row will be a painful task. Here, I can talk you about some useful methods to solve this job.

Return the first non blank cell in a row or column with formula

Return the last non blank cell in a row or column with formula


arrow blue right bubble Return the first non blank cell in a row or column with formula

To extract the first cell with data, please apply the following formula:

1. Enter the following formula into a blank cell besides your data: =INDEX(A1:A13,MATCH(TRUE,INDEX((A1:A13<>0),0),0)), see screenshot:

doc-return-first-data-cell-1

2. Then press Enter key, and you will get the first non blank cell value as follows:

doc-return-first-data-cell-1

Notes:

1. In the above formula, A1:A13 is the column range that you want to use, you can change it to your need. This formula also can be applied to get the first non blank cell value in a row, you just need to change the column range to row range.

2. This formula just work correctly on single row or single column.


arrow blue right bubble Return the last non blank cell in a row or column with formula

If you want to return the last non blank cell value, here is another formula can do you a favor.

1. Type this formula =LOOKUP(2,1/(A1:A13<>""),A1:A13) into a blank cell besides your data, see screenshot:

doc-return-first-data-cell-1

2. Then press Enter key, the last non blank cell value will be extracted at once. See screenshot:

doc-return-first-data-cell-1

Notes:

1. In the above formula, A1:A13 is the column range that you want to use, you can change it to your need. This formula also can be applied to get the last non blank cell value in a row, you just need to change the column range to row range.

2. The above formula just work correctly on single row or single column.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
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