Last value of a row that is not empty
Hello everyone,
I have to make a milestone tracker that I update week by week by adding a new column (the rows are the projects). I can't just modify a column because they require me to keep a history of the data. columns (date type) can contain a value or be empty. I need to get the last updated date for each project (not necessarily this value will be the maximum of the array).
For example, I would have an array of columns with information [" ", 6, 3, " ", 1, 2, " "] and I would need to extract the value of 2 in an additional column (for this example).
I've tried doing a reverse ifelse tree (starting from the last value to the first) looking for the last nonempty column, but it's not scalable.
I would appreciate any help or suggestion. It is important to clarify that SmartSheets do not have loop functions (while() or for()) and there is no Hloopup() either.
Thanks in advance,
Best Answer

I wanted to give me shot at this one, as it seemed like a nice challenge! To summarize what my solution does, it will take the farthest rightmost nonblank cell in the range from [Week 1]:[Range Extender]. So if I had been understanding your question, you could add week 9 in between Week 8 and Range Extender per my screenshot below, and if you'd plug a value into week 9, it would return that value instead of 2.
To translate the formula below to regular language, it joins all the nonblank values with a unique character (* in my case), and then it replaces the last instance of * (SUBSTITUTE has the optional [replace_num] function, which can be used to determine the last instances of * using COUNT nonblank cells) with a separate unique character (&). Then you can use the RIGHT(LEN(FIND combo to return the last non blank value.
=RIGHT(SUBSTITUTE(JOIN(COLLECT([Week 1]@row:[Range Extender]@row, [Week 1]@row:[Range Extender]@row, <>""), "*"), "*", "&", COUNT([Week 1]@row:[Range Extender]@row)  1), LEN(SUBSTITUTE(JOIN(COLLECT([Week 1]@row:[Range Extender]@row, [Week 1]@row:[Range Extender]@row, <>""), "*"), "*", "&", COUNT([Week 1]@row:[Range Extender]@row)  1))  FIND("&", SUBSTITUTE(JOIN(COLLECT([Week 1]@row:[Range Extender]@row, [Week 1]@row:[Range Extender]@row, <>""), "*"), "*", "&", COUNT([Week 1]@row:[Range Extender]@row)  1)))
Jason Tarpinian  Sevan Technology
Smartsheet Aligned Partner
Answers

I would suggest a helper row where you can put numbers across in ascending order from left to right. This will allow us to figure out what the highest number is that has data in it on each row.
1, 2, 3, 4, 5, etc.
From there you would insert a placeholder column on the far right of the sheet Put the number zero in the helper row of this column). You want to insert any new columns for data entry to the LEFT of this placeholder column. This will allow you to automatically include new columns in the formula so that you don't have to manually adjust the ranges whenever new columns are added.
Then you can use something like this:
=INDEX([First Column]@row:[Placeholder Column]@row, 1, MAX(COLLECT([First Column]$1:[Placeholder Column]$1, [First Column]@row:[Placeholder Column]@row, @cell <> "")))
If you do not want to use the helper row, then you would need to enter something in the blank columns such as "N/A" or "" or anything else really so that the cell is not blank.
From there you would still need the placeholder column (this can be hidden in both options once it is set up) and your formula would look like this:
=INDEX([First Column]@row:[Placeholder Column]@row, 1, COUNTIFS([First Column]@row:[Placeholder Column]@row, @cell <> ""))

I wanted to give me shot at this one, as it seemed like a nice challenge! To summarize what my solution does, it will take the farthest rightmost nonblank cell in the range from [Week 1]:[Range Extender]. So if I had been understanding your question, you could add week 9 in between Week 8 and Range Extender per my screenshot below, and if you'd plug a value into week 9, it would return that value instead of 2.
To translate the formula below to regular language, it joins all the nonblank values with a unique character (* in my case), and then it replaces the last instance of * (SUBSTITUTE has the optional [replace_num] function, which can be used to determine the last instances of * using COUNT nonblank cells) with a separate unique character (&). Then you can use the RIGHT(LEN(FIND combo to return the last non blank value.
=RIGHT(SUBSTITUTE(JOIN(COLLECT([Week 1]@row:[Range Extender]@row, [Week 1]@row:[Range Extender]@row, <>""), "*"), "*", "&", COUNT([Week 1]@row:[Range Extender]@row)  1), LEN(SUBSTITUTE(JOIN(COLLECT([Week 1]@row:[Range Extender]@row, [Week 1]@row:[Range Extender]@row, <>""), "*"), "*", "&", COUNT([Week 1]@row:[Range Extender]@row)  1))  FIND("&", SUBSTITUTE(JOIN(COLLECT([Week 1]@row:[Range Extender]@row, [Week 1]@row:[Range Extender]@row, <>""), "*"), "*", "&", COUNT([Week 1]@row:[Range Extender]@row)  1)))
Jason Tarpinian  Sevan Technology
Smartsheet Aligned Partner
Help Article Resources
Categories
 All Categories
 14 Welcome to the Community
 Smartsheet Customer Resources
 61.3K Get Help
 321 Global Discussions
 197 Industry Talk
 415 Announcements
 4.2K Ideas & Feature Requests
 126 Brandfolder
 153 Just for fun
 124 Community Job Board
 441 Show & Tell
 26 Member Spotlight
 1 SmartStories
 278 Events
 34 Webinars
 7.3K Forum Archives
Check out the Formula Handbook template!