Returning the Last Value in a variable Row

xcellrodeo

Board Regular
Joined
Oct 27, 2008
Messages
195
Hi everyone,

I have a range of data starting in Row A8 and ending in AL45.
What I am trying to do is to return the last value in each row.
The twist in the matter is that the column within the row to be evaluated varies. i.e
This would represent the range for which I need the latest value to be returned
=INDEX(L9:O9,1,MAX(--(L9:O9<>"")*COLUMN(L9:O9)))

However I am finding that only the lower formula works.
=INDEX(A14:O14,1,MAX(--(A14:O14<>"")*COLUMN(A14:O14)))

Whenever I change A14:O14 to L9:O9, an error message #Ref or #Value is returned.

Can somebody help?
Thanks
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
In AM column you could use the following formula copied down:

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

bosco_yip

Well-known Member
Joined
Dec 2, 2002
Messages
1,938
Office Version
2019
Platform
Windows
Change this :

{=INDEX(L9:O9,1,MAX(--(L9:O9<>"")*COLUMN(L9:O9)))}

to this :

{=INDEX(L9:O9,1,MAX((L9:O9<>"")*COLUMN(L9:O9)-COLUMN(K9)))}

Or, used Richard Schollar's formula

Regards
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,902
Messages
5,514,052
Members
408,982
Latest member
starryeyed223

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top