Home » excel » excel – Return last value in a row, based on another cell value

excel – Return last value in a row, based on another cell value

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a sheet with the following basic format:

User:     Steve          Latest  9

Name       Period 1        Period 2        Period 3         Period 4

Colin         3               9               7                
Jo            1               6               0       
Steve         4               2               9       
Kate          2               8               1       

So basically, I want to populate the value of ‘Latest’ with the last value in the row, based on the value of ‘User’.

So if I changed the value of ‘User’ to a different person, it would return the last value in that particular row. (e.g. User: Colin Latest: 7)

I can retrieve the value of a single column using =INDEX(B5:B8,MATCH(B1,A5:A8,0))however I’m struggling when it comes to the array.

I’ve tried going doing the path of embedding a LOOKUP within INDEX / MATCH, and also array formulas to return the nth value, but none of them seem to work. Also having zero luck using something like =MAX(ROW(A3:A7)*(--(B1=A3:A7)))

I think I’ve worked myself down a blind alley, so a nudge in the right direction would be much appreciated.

How to&Answers:

This will return the last number in the row that matches the input:

=INDEX($5:$8,MATCH($B$1,$A$5:$A$8,0),MATCH(1E+99,INDEX($5:$8,MATCH($B$1,$A$5:$A$8,0),0)))

enter image description here