Vlookup function to look for similar value but the different return value

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
343
Office Version
  1. 365
Platform
  1. Windows
I have a source data (code column) that has duplicate values with different names.. Would it be possible for a Vlookup function combination with other function to look for similar value but the different return value. Please find below expected result.. thank you..


sourceexpected result
CodeNameCodeName
AAALaraAAALara
BBBGayleAAAWelles
CCCPontingBBBGayle
AAAWellesBBBPerot
BBBPerotCCCPonting
CCCMurdochCCCMurdoch
DDDKiplingDDDKipling
EEECoolidgeEEECoolidge
EEEPorterEEEPorter
GGGConneryGGGConnery
HHHBeattyGGGFenty
GGGFentyHHHBeatty
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Not sure which of the three listed versions of Excel you are using for this, but if using 365, you can simply use the new SORT function, as that is all it really appears you are doing, i.e.
Excel Formula:
=SORT(A3:B14)

See: SORT function - Microsoft Support
 
Upvote 0
Not sure which of the three listed versions of Excel you are using for this, but if using 365, you can simply use the new SORT function, as that is all it really appears you are doing, i.e.
Excel Formula:
=SORT(A3:B14)

See: SORT function - Microsoft Support
using 365.. but i would like is a formula with vlookup function (if possible) that will return the name from the expected result
 
Upvote 0
using 365.. but i would like is a formula with vlookup function (if possible) that will return the name from the expected result
VLOOKUP only returns one record, by its very nature.

Why insist on using a function that doesn't do what you want, when there is one that does, and does it very easily?
I am just trying to understand why the insistence on VLOOKUP. It feels like there might be something important you are not telling us.
Otherwise, it does not seem to make much sense.
 
Upvote 0
VLOOKUP only returns one record, by its very nature.

Why insist on using a function that doesn't do what you want, when there is one that does, and does it very easily?
I am just trying to understand why the insistence on VLOOKUP. It feels like there might be something important you are not telling us.
Otherwise, it does not seem to make much sense.
thanks..actually, it is more like a screening question for problem solving skills. i solved that using other function but insist to use vlookup. Now i am bit curious if it can be really done by vlookup..
 
Upvote 0
thanks..actually, it is more like a screening question for problem solving skills. i solved that using other function but insist to use vlookup. Now i am bit curious if it can be really done by vlookup..
It may possibly be able, but I think it is going to be needlessly complex. I think you would have to find where the first one is found, and then start the second VLOOKUP from that point on, so you don't return the first one again. Might be better to use INDEX/MATCH than VLOOKUP. But if you are trying to lookup multiple values in column A, it could really get crazy (unless someone knows some good "tricks").

IMO, the effort isn't really worth it. I don't think it is a method any reasonable person would ever use, when they are much better options available.
Some of the newer functions, like SORT and FILTER make these sort of questions much easier.
 
Upvote 0
It may possibly be able, but I think it is going to be needlessly complex. I think you would have to find where the first one is found, and then start the second VLOOKUP from that point on, so you don't return the first one again. Might be better to use INDEX/MATCH than VLOOKUP. But if you are trying to lookup multiple values in column A, it could really get crazy (unless someone knows some good "tricks").

IMO, the effort isn't really worth it. I don't think it is a method any reasonable person would ever use, when they are much better options available.
Some of the newer functions, like SORT and FILTER make these sort of questions much easier.
i agree.. thank you
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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