Search code examples
google-apps-scriptgoogle-sheetsarray-formulas

How to find the last value in a row in Google Sheets?


I need to collect the rightmost values in one column, the last values in a row from a table, see Example. This is a table of changes in commodity prices over time. It is necessary to display the last price for the goods in a separate column. Solutions are welcomed by both array formula and Apps script.

Example

Tried the HLOOKUP(99999,F2:J2,TRUE) function Line by line works, unstable in ArrayFormula(HLOOKUP(99999,F2:J5,TRUE))


Solution

  • Here's one more approach:

    =byrow(F2:J,lambda(Σ,iferror(choosecols(torow(Σ,1),-1))))
    

    enter image description here