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
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:
2. Then press Enter key, and you will get the first non blank cell value as follows:
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.
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:
2. Then press Enter key, the last non blank cell value will be extracted at once. See screenshot:
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.
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
More than 300 powerful features. Supports Office/Excel
2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.
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
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??
The formula that Ankur posted does return the value of the last non-blank cell in the specified range (column). If you are looking to make this work across columns on a single row, then change "ROWS" to "COLUMNS" within the formula.
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?
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<>=””))
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
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.