Finding Last value

roanscar

New Member
Joined
Oct 19, 2006
Messages
3
I know I have seen this on the boards before but now can't find it.

Here is a sample of what the data will look like for columns a & b:

A B
Red 25
Red 30
Red 14
Blue 25
Blue 13


I am trying to get a formula so that it will return the last value entered in column B based on the value in column A[/i]
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Thank you sir!

Out of curiousity, what would the formula be if the reds and blues were intermingled?
 
Upvote 0
Try eg:

=INDEX(B1:B5,MAX(IF(A1:A5="Red",ROW(INDIRECT("1:"&ROW(A5))),0)))

which must be confirmed with Ctrl+Shift+Enter, not just Enter. If correctly entered Excel will surround this array formula with curly braces {}.
 
Upvote 0
=INDEX(B1:B5,MAX(IF(A1:A5="Red",ROW(A1:A5)-ROW(A1)+1)))

which needs to be confirmed with control+shift+enter, not just with enter.

A different idiom is:

=LOOKUP(2,1/(A1:A5="Red"),B1:B5)

which needs just enter.
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top