How to Find Last Cell with Value in a Row in Excel (6 Ways)

If you have a very large dataset, it can be quite time-consuming to find the last cell with value in a row in your Excel dataset. In this article, I’ll introduce you to 6 methods by which you can easily find the last cell with value in a row in Excel.

Consider the following dataset. Here Information about different customers who have applied for a bank loan is given. Now we will find the last cell with data in a row using this dataset.

Let’s see how we can perform this task in 6 different ways.


1. Using Keyboard Shortcut to Find the Last Cell with Value in a Row in Excel

The easiest way to find the last cell with a value in a row is by using the keyboard command.

Just click on the row’s first cell and press CTRL+ Right Arrow Key.

Excel Find Last Cell with Value in Row

Your cursor will move to the last non-empty cell in that row.

Excel Find Last Cell with Value in Row

Read more: How to Find Last Cell with Value in Column in Excel


2. Getting the Last Cell with Value in a Row by Using OFFSET Function in Excel

If you know the number of columns and rows of your dataset, you can find the last cell value in any row by using the OFFSET function. To find out the last cell value in Row 6, type the formula in an empty cell,

=OFFSET(B4,2,7,1,1)

Here,

  • B4 = First cell of the dataset
  • 2 =  Number of the row of your dataset excluding the first row
  • 7 =  Number of the column of your dataset excluding the first column
  • 1 = cell height
  • 1 = cell width

Press ENTER and you will find the value of the last cell of Row 6, in your selected cell.

Excel Find Last Cell with Value in Row


3. Using Excel INDEX and COUNTA Functions to Find the Last Non-Blank Cell in a Row

Using the INDEX function along with the COUNTA function allows you to find the last cell value of any row. To find the last cell value in Row 5, type the following formula in an empty cell,

=INDEX(B5:I12,1,COUNTA(5:5))

Here,

  • 5:5 = Row 5
  • B5:I12 = Array
  • 1 = row_num

You will find the value of the last cell of Row 5, in your selected cell.

Excel Find Last Cell with Value in Row

🔎 Formula Breakdown

↪️ The COUNTA function counts the number of cells in a range that are non-empty.

COUNTA(5:5) returns the total number of non-empty cells in Row 5 => 8

↪️ INDEX(B5:I12,1,COUNTA(5:5)) = INDEX(B5:I12,1,8) = 23

So, final Output => 23


4. Using the MATCH Function to Find the Last Cell with Value in a Row in Excel

Using  the MATCH function, you can find the number of the last cell with a value in any particular row.

Here, our lookup cell value is 25 which exists in Row 10. We want to find the relative position of 25 in Row 10, type the following formula in any of the empty cells,

=MATCH(D14,10:10,0)

Here,

  • D14 = lookup_value
  • 10:10 = Row 10
  • 0 = Exact match

You will find the number of the last non-empty cell of Row 10, in your selected cell.

Excel Find Last Cell with Value in Row


5. Finding the Last Cell Value in a Row Using Excel LOOKUP Function

You can find the last cell value of the last row by using the LOOKUP function. Type the formula in an empty cell,

=LOOKUP(2,1/(I:I<>""),I:I)

Here, I:I = Last column of the dataset

After pressing ENTER, You will find the value of the last cell of the last row of the dataset, in your selected cell.

Excel Find Last Cell with Value in Row


6. Applying HLOOKUP Function to Find Last Cell with Value in a Row in Excel

Using the HLOOKUP Function is another way to find the value of the last cell of any row. Now we will find the last cell of Row 8 in our dataset. To find the value, type the formula in an empty cell,

=HLOOKUP(I4,B4:I12,5,FALSE)

Here,

  • I4= Last column of the first row (Reference cell)
  • B4:I12 = Range of Dataset
  • 5 = 5th Row of our dataset including the reference cell’s row
  • FALSE = Exact Match

You will find the value of the last cell of Row 8, in your selected cell.

Read More: How to Find Last Non Blank Cell in Row in Excel


Download Practice Workbook


Conclusion

So, we’re done! You can follow any of the ways described above to find the last cell with value in a row in Excel. Please leave a comment if you face any unexpected situations. To get acquainted with more Excel features and functions, kindly visit our website. We always try to provide quick solutions to your problems.


Further Readings


<< Go Back To Excel Last Value in Range | Excel Find Value in Range | Excel Range | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Prantick Bala
Prantick Bala

PRANTICK BALA is a marine engineer who loves exploring Excel and VBA programming. Programming, to him, is a time-saving tool for efficiently managing data, files, and internet tasks. He is proficient in Rhino3D, Maxsurf, C++, MS Office, AutoCAD, Excel, and VBA and goes beyond the basics. Armed with a B.Sc in Naval Architecture & Marine Engineering from BUET, he has transitioned into the role of a content developer. Beyond his work, find him immersed in books, exploring new... Read Full Bio

6 Comments
  1. How do you do #3 above, but pulling from another workbook? Thank you!

    • Hello ANTHONY,
      Here, we’ll get the value of the last cell of a row and show it in cell C14.

      But, as per your condition, we’ll retrieve this value from another workbook named Sales. Now, we want to extract the value of the last cell of Row 5 from the Dataset worksheet of this workbook.

      To do this,
      • At first, select cell C14 and call the INDEX function.

      • Then, select cells in the B5:E5 range.

      • After that, insert the COUNTA function and select the same range as the argument.
      • As usual, press the ENTER button.

      • Finally, you can see the result in cell C14 and the final form of the formula is like the following.
      =INDEX([Sales.xlsx]Dataset!$A$5:$D$5,COUNTA([Sales.xlsx]Dataset!$A$5:$D$5))

      Here, the part inside the square brackets are the name of the workbook. And the part before the exclamation mark and after the square bracket is the name of the worksheet.
      That’s how you can do it from another workbook. It’s all from me on this topic. Follow our website, ExcelDemy, a one-stop Excel solution provider, to explore more.

  2. Awesome, thank you that was helpful! Any chance you know how to reference 2nd to last cell with data from the other workbook?

    • Hello ANTHONY,
      If your second to the last row is situated in Row 11, then you can use the following formula.
      =INDEX(‘[Sales.xlsx]Dataset’!$A$11:$H$11,COUNTA(‘[Sales.xlsx]Dataset’!$A$11:$H$11))
      You have to just change the reference according to the position of your desired row.

      Best Regards
      Tanjima Hossain

  3. Hi, how you can exclude a specific value thorugh the whole row?

    • Hello PEDRO,
      As per your question, I will try to show an easier way to remove a specific value from a row. Here, we have the specific text “Furniture” in three rows which we will remove from these rows.

      1

      • Go to the Home tab >> Find & Select dropdown >> Replace option.

      2

      Then, you will have the Find and Replace dialog box.

      • Type Furniture in the Find what box, and blank in the Replace with box.
      • Click on Replace All.

      3

      Then, a message box will notify you about the number of replacements.

      4

      In this way, we have removed Furniture from three rows.

      5

      If you want to remove this specific text from a specific row only, then before doing the stated procedures just select that specific row.

      Best Regards,
      Tanjima Hossain

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo