Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Refer to last cell in column or in row in a function

Hi. Is there a way to refer to the final cell in a column and/or row? I am making a spreadsheet that will have some values in columns and then a total in the final column. This spreadsheet will be manually updated occasionally to add a new row with new values, and therefore a new total. This new info will not replace the preexisting info, hence the new row. I want another sheet to always refer to the total cell that has the most up-to-date total, which will be the final column in the final row. The final column number will probably be consistent, but you see the final row will always be changing. Is there a way to do this?


To put it in other words, for example:


Col 1 | Col 2 | Total

59 | 1 | 60


In this case the function would refer to A3. But later this sheet may be updated with another row


Col 1 | Col 2 | Total

59 | 1 | 60

60 | 5 | 65


Now I want the function to refer to B3. But I don't want to manually update the function each time. So I want it to always refer to the final cell in column 3. Is this possible?


Thank you for any help.

MacBook Pro 13″, macOS 10.15

Posted on Dec 15, 2020 1:30 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 15, 2020 2:24 PM

If the table has one header row and there are no gaps in the data in the column (i.e., no empty rows in the middle), a formula that would do it is

=OFFSET(B$1,COUNTA(B),0)


If you are using a recent version of Numbers, here is one that will give you the last cell that contains an alphanumeric. You can have gaps in the data.


=XLOOKUP(REGEX("\d|\w"),B,B,"",2,-1)


For some math operations you might want to replace the "" with a zero. If there are no values in the column, the result will be a null string "" and if you have a later formula that does math operation on it (+-*/) it will be an error. That would be a case where you might want it to be a zero.

Similar questions

4 replies
Question marked as Top-ranking reply

Dec 15, 2020 2:24 PM in response to dbooster

If the table has one header row and there are no gaps in the data in the column (i.e., no empty rows in the middle), a formula that would do it is

=OFFSET(B$1,COUNTA(B),0)


If you are using a recent version of Numbers, here is one that will give you the last cell that contains an alphanumeric. You can have gaps in the data.


=XLOOKUP(REGEX("\d|\w"),B,B,"",2,-1)


For some math operations you might want to replace the "" with a zero. If there are no values in the column, the result will be a null string "" and if you have a later formula that does math operation on it (+-*/) it will be an error. That would be a case where you might want it to be a zero.

Refer to last cell in column or in row in a function

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.