# Returning the Last Value in a variable Row

#### xcellrodeo

##### Board Regular
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

### 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
In AM column you could use the following formula copied down:

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

Excellent!
Thank you kindly

#### bosco_yip

##### Well-known Member
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

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