简体   繁体   中英

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

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. (eg 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.

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM