Search columns A OR B for result in C

Sleepingsouls

New Member
Joined
Jan 22, 2018
Messages
20
Hi Guys,

Having a little trouble with a look up I have tried Vlookup with no luck and I have Tried Index Match... But I think I'm missing something important - or at least not getting it exactly right.

ABCDEF
1First NameLast NameID
2John Smith1Search
3JamesSamuels2ID
4JackyGrant3

<colgroup><col><col><col><col><col span="3"></colgroup><tbody>
</tbody>
What I want to be able to do is search for either column A or B and return C as the result - So if I type in John it will return 1 or if I type in Smith it will return 1.

Thank you.

<tbody>
</tbody>
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
How do you propose handle duplicates, especially if you are wanting to search both columns?
For example, what if you had someone named "James Samuels" and another person named "Jesse James"?

The probability of duplicate names within one column is already high, but will be even higher if now searching across two columns.
 
Upvote 0
This was just an example in my actual database there are no duplicates. They are location names and then the code name given to those locations.
 
Upvote 0
Why not try nesting two VLOOKUPs (one for each column) inside an IFERROR statement?
So if the first VLOOKUP fails because it cannot find it, it will do the second?

The structure of the function would look like this:
Code:
=IFERROR(VLOOKUP(...),VLOOKUP(...))

If it is possible that it might not be found at all in either, than you can nest inside another IFERROR, i.e.
Code:
=IFERROR(IFERROR(VLOOKUP(...),VLOOKUP(...)),"Not found")
 
Last edited:
Upvote 0
Ooooo I'll give that a try! Thanks so much Joe I'll let you know how it goes. As is always the case I try to get to creative and look over the simple things.
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,214,619
Messages
6,120,550
Members
448,970
Latest member
kennimack

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