# 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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

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

Replies
3
Views
86
Replies
5
Views
333
Replies
5
Views
401
Replies
5
Views
159
Replies
2
Views
437

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,916
Messages
5,834,363
Members
430,279
Latest member
mkasledge1

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back