When working with a large dataset, you may need to identify the last non-blank row in a column, especially when your data includes empty rows between. This is useful for creating dynamic ranges, automating reports, or performing new entries.
In this article we will show you 3 simple formula-based methods to find the last row that contains data.
Steps to Find the Last Row with Data Using Formula:
➤ Select the output cell where you want the result.
➤ Enter the following formula:
=MAX(ArrayFormula(IF(LEN(A:A), ROW(A:A), 0)))
➤ Press Enter.
➤ It will return the last row number that contains any value in column A.
Using ARRAYFORMULA and IF to Get Last Row Dynamically
If you want to get the last row with data dynamically, you can use the following formula. Here, we use the ARRAYFORMULA function combined with IF to evaluate the entire column and return the correct result.
Steps:
➤ Click on the output cell (e.g., G5) to insert the formula:
=MAX(ArrayFormula(IF(LEN(A:A), ROW(A:A), 0)))
➤ Press Enter.
The formula will return 14, which is the row number of the last non-empty cell in column A.
Using INDEX with FILTER to Get Last Value in Column
If you want to retrieve the last non-empty value in a column dynamically, you can use the following formula. This approach uses the INDEX function combined with FILTER to find the last numeric or text value in a column by searching for a large value in an array.
Steps:
➤ Click on a blank cell (e.g., F3) to insert the formula and Paste the following formula
=INDEX(FILTER(A2:A100,A2:A100<>””),COUNTA(FILTER(A2:A100,A2:A100<>””)))
➤ Press Enter. This will return the last non-empty employee name from column A.
Find Last Row Number with FILTER and MAX
To get the last row number with data, you can use a combination of the FILTER and MAX functions. This method efficiently identifies the last row number with data.
Steps:
➤ Click on a blank cell (e.g., G3) to insert the formula and paste
=MAX(FILTER(ROW(A:A), TRIM(A:A)<>””))
➤ Press Enter. The formula will return 14, which is the row number of the last non-empty cell in column A.
Frequently Asked Questions
What if I want to find the last row of column B instead?
Just change the column reference:
=MAX(ArrayFormula(IF(LEN(A:A), ROW(A:A), 0)))
Can I use this formula to find the last column instead of the row?
No. This formula works only for rows. For column you have to use COLUMN() with similar logic.
Will it detect numeric or data values too?
Yes. Any non-empty value (text, number, or date) is considered.
Can I limit the search to a specific range (e.g., B2:B100)?
Yes. Just modify the formula:
=MAX(ArrayFormula(IF(LEN(B2:B100), ROW(B2:B100), 0)))
Wrapping Up
Using these formulas, you can easily find the last row with actual data in Google Sheets. This is especially useful when dealing with incomplete data sheets or automating tasks. This is simple, fast, and does not require any scripting knowledge.