Get index of last column with any data in a row

Copper Contributor

I can get the last column with any data in a row using this formula as described here

 

 

=LOOKUP(2,1/(1:1<>""),1:1)

 

 

How can I get the index of this column?

 

My sheet looks similar to this one (so I have values to the left and right of the cell containing the result)

AlexanderZeitler_0-1693947698009.png

 

2 Replies

@Alexander Zeitler 

For me it would be

= BYROW(numbers, 
    LAMBDA(row, 
      XMATCH(TRUE, ISNUMBER(row), , -1)
    )
  )

but that would require 365.  Note: the index returned is relative to the array 'numbers' and not to the sheet.

@Alexander Zeitler 

If under the index you mean column number, as variant that could be

=LOOKUP(1E+307,COLUMN(1:1)*IF(1:1="","",1))

entered as array formula (Ctrl+Shift+Enter) on other than 365 or 2021 Excel.