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
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:
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.
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:
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
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...
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!