Formula for latest number from a ROW

Hi everyone,


Is there a formula for this? I would like the table in front of the orange card "current weight" to automatically display, in real time, the latest value I manually add to the purple table under it on ROW "weight (kg)".


Not sure if it matters, but on the purple table, COLUMN 'S' is just a ready to add a value whenever I need to. The value on 'S3' cell is just an already formulated cell to substract 'S2' from my "weight goal" which at the moment 'S2' is 0.



Thank you in advance on your interest to help out and pray for my weight loss cuz it's been a lovely journey!


Pedro

iMac (M1, 2021)

Posted on Oct 11, 2023 2:43 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 11, 2023 9:08 PM

pedrogilg wrote:

I would like the table in front of the orange card "current weight" to automatically display, in real time, the latest value I manually add to the purple table under it on ROW "weight (kg)".


You can use XLOOKUP to find the last value, whether or not there are gaps in the data.




=XLOOKUP(REGEX("."),Table 1::2:2,Table 1::2:2,"no entries",2,-1)


This searches from the last cell to the first cell in the search-range and returns the value in the first cell that it finds that has something in it (that . in regex means any character).


More on XLOOKUP here:


XLOOKUP - Apple Support (HK)



This will work also if you decide to arrange your data vertically. Just select the appropriate search-range, will will then be vertical instead of horizontal as in your screenshot.


Use ; instead of , in the formula if your region uses , as the decimal separator.


SG


7 replies
Question marked as Top-ranking reply

Oct 11, 2023 9:08 PM in response to pedrogilg

pedrogilg wrote:

I would like the table in front of the orange card "current weight" to automatically display, in real time, the latest value I manually add to the purple table under it on ROW "weight (kg)".


You can use XLOOKUP to find the last value, whether or not there are gaps in the data.




=XLOOKUP(REGEX("."),Table 1::2:2,Table 1::2:2,"no entries",2,-1)


This searches from the last cell to the first cell in the search-range and returns the value in the first cell that it finds that has something in it (that . in regex means any character).


More on XLOOKUP here:


XLOOKUP - Apple Support (HK)



This will work also if you decide to arrange your data vertically. Just select the appropriate search-range, will will then be vertical instead of horizontal as in your screenshot.


Use ; instead of , in the formula if your region uses , as the decimal separator.


SG


Oct 11, 2023 4:32 PM in response to pedrogilg

If there are no gaps in the data, meaning all columns to the left of the "latest" are filled in, below is a formula (assuming the table name is Table 1).


First convert column A to a header column. You should also convert row 1 to a header row.

=OFFSET(Table 1::B3,0,COUNTA(Table 1::3:3)−1)


This formula will not work if you have gaps in your data. You can fill the gaps with something else, like a dash, and the formula will work.






Oct 11, 2023 6:31 PM in response to pedrogilg

I would say that a table like that should be laid out vertically though. Imagine if you have 100 values, scrolling left-right is much more annoying than scrolling up-down.


If you decide to transpose rows and columns (menu Table), Badunit's formula would become:

=OFFSET(Table 1::B2,COUNTA('weight (kg)')−1,0)



Your next logical step is to select columns A and B and select a scatter plot chart (bottom left in the chooser) to track your progress.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Formula for latest number from a ROW

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