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.

[TABLE="width: 512"]
<colgroup><col><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]First Name[/TD]
[TD]Last Name[/TD]
[TD]ID[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]John [/TD]
[TD]Smith[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD]Search[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]James[/TD]
[TD]Samuels[/TD]
[TD="align: right"]2[/TD]
[TD][/TD]
[TD]ID[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]Jacky[/TD]
[TD]Grant[/TD]
[TD="align: right"]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 448"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD]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.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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

Forum statistics

Threads
1,223,723
Messages
6,174,107
Members
452,544
Latest member
aush

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