Obtaining value from most recent duplicate

teddie

New Member
Joined
Sep 21, 2018
Messages
4
Hi All,

I have a vertical list from A1:G1

John
Fred
Alex
John
Tim
Fred
John

There are also values in B1:G1 next to those names which are irrelevant. For the second "John" I need a formula to search the vertical list above it (from bottom to top), find the first "John", and obtain the value next to it.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hello and Welcome to the Forum :smile:

You could test following formula :

Code:
=IFERROR(INDIRECT("B"&MATCH(A2,OFFSET($A$1,0,0):OFFSET(A2,-1,0),0)),"")

Hope this will help
 
Upvote 0
I couldn't evaluate James's proposal. Hence the following.


Book1
ABCDE
1Johndaxfredwax
2Fredwaxjohnzax
3Alexnax
4Johnzax
5Timwax
6Fredjax
7Johnxax
Sheet1


In E1 control+shift+enter, not just enter, and copy down:

=T(OFFSET($B$1:$B$7,ROWS($A$1:$A$7)-1,0,-SMALL(IF(T(OFFSET($A$1:$A$7,ROWS($A$1:$A$7)-1,0,-(ROW($A$1:$A$7)-ROW($A$1)+1)))=D1,ROW($A$1:$A$7)-ROW($A$1)+1),2)))

Note 1. Change the T function to the N function if the range in question is numeric.
Note 2. If so desired, you can have 2 (indicator of the second instance) in a cell of its own and substitute that cell address for 2 in the formula.
 
Upvote 0
Hello and Welcome to the Forum :smile:

You could test following formula :

Code:
=IFERROR(INDIRECT("B"&MATCH(A2,OFFSET($A$1,0,0):OFFSET(A2,-1,0),0)),"")

Hope this will help

Hi James,

Thanks for the response. This formula works for the second “John” but not the third. So for the third “John” I would need it to grab what’s next to the second “John”. The fourth “John” would need to grab what’s next to the third...and so on.
 
Upvote 0
It doesn’t correlate to my spreadsheet. You added something in D1. My spreadsheet is vertical and I need a formula to copy down when there are numerous duplicates.
 
Upvote 0
It doesn’t correlate to my spreadsheet. You added something in D1. My spreadsheet is vertical and I need a formula to copy down when there are numerous duplicates.

I don't follow what you are trying to say. Didn't you ask

For the second "John" I need a formula to search the vertical list above it (from bottom to top), find the first "John", and obtain the value next to it.

If my understanding is not correct, care to post what the desired values are for the sample you posted?
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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