HomeGoogle DocsSpreadsheetFind the Cell Address of a Last Used Cell in Google Sheets

Find the Cell Address of a Last Used Cell in Google Sheets

Published on

There are no built-in functions to find the cell address of a last used cell in Google Sheets. But I’ve two custom formulas to do this.

Keep one thing in mind if you opt to use any of them. Both of the formulas may fall short of returning a perfect result if there is any blank cell in the ‘primary’ column in the range. I’ll explain it.

Primary Column:

In your data range, there may be multiple columns. For example, a range like A1: G has 7 columns and infinitive rows.

In this, you can set any column as primary in my formula. For example, you can use Column A.

The formula may revolve around this column and blank cells in this column can return wrong results. So choose a column that does not contain blank cells in your range.

This formula is different from what you may think!

Normally with a lookup formula, we can find the cell address of a lookup value. But here the case is different. We are here to find the cell address of a last used cell, not the cell address of a search key found.

How to Find the Cell Address of a Last Used Cell in Google Sheets

Formula 1:

I’ve used three functions here to find the cell address of a last used cell in a range. The functions are CELL, INDEX, and COUNTA. But the main function in this formula is, of course, the INDEX.

return cell address of a last used cell in a column

Formula Explanation:

First, let me explain the role of Index function here.

With the Index function, my aim is to return the last cell value. From this value, we can find the last cell address.

Syntax:

INDEX(reference, [row], [column])

Formula:

=INDEX(A1:G,countA(A1:A),cell("col",G1))

Here we have already the “reference” to use in Index and it’s A1: G. Now we want to find the last row number in our data range.

Here I’ve used CountA function in Column A which is my primary column here. Of course, CountA has an edge over the Count function as it accepts both numbers as well as text in the count.

It’s easy to find the column number as we know our last column in the data range is column G.

You can directly put 7 as G represents column number 7. Alternatively, the Cell formula returns Column number of G. Actually here the formula is like;

=INDEX(A1:G,9,7)

Result: 99 (the last cell value in the range in G9.

You can use the above Index formula to return the last cell value in a range. Remember! not last used cell address.

Now we can use the Cell function “address” info type to return the address of this cell containing the value 99.

Formula

=CELL("ADDRESS",index(A1:G,9,7))

Which is equal to

=CELL("address",index(A1:G,countA(A1:A),cell("col",G1)))

Result: $G$9

Formula 2

Here is one more formula to find the Cell Address of a last used cell in Google Sheets. This’s an entirely different approach.

As you can see the main functions here in this example are ADDRESS, ARRAYFORMULA, MIN, IF and ROW.

return cell address of last cell in a column

The below formula is the main part here and here my primary column is G. So any blank cell in this column possibly return a wrong result.

=ArrayFormula(MIN(IF(G2:G="",ROW(G2:G)-ROW(G2)+1)))

Result: 9

Formula Explanation:

When you use this formula independently, after removing the MIN, for example in H2, it may return serial number 1,2,3 starting from H2 to downwards.

But the IF logical function may force the formula to put serial number only in H10. Because the formula only returns numbers wherever the cell value in G is blank.

That means it only returns the number 9 in H10 as G10 is blank and in all the other cells, it returns FALSE. The MIN function in this range returns the number 9.

If you have still doubt, I have a detailed tutorial on this. Please check that.

Similar: How to Count Until a Blank Row in Google Sheets

So the formula is;

=address(ArrayFormula(MIN(IF(G2:G="",ROW(G2:G)-ROW(G2)+1))),7)

Which is equal to;

=address(9,7)

Result: $G$9

That’s all. This way you can find the Cell Address of a Last Used Cell in Google Sheets.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

SUMPRODUCT Differences: Excel vs. Google Sheets

The core purpose of the SUMPRODUCT function remains consistent across both Excel and Google...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.