Looking up value of 2 columns to return a value from a third column

Curioxity

New Member
Joined
Jun 16, 2011
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm sure I'm being incredibly dense here but I just can't seem to make this really simple function work.

I have 3 columns that I want to run a formula on - I'm trying to write a formula to look up a value in one column, check another column to see if a specific text appears in it, and if so, return the value from a third column that contains an ID relating to those. So the formula will go in a column for each of those Names to produce their code individually as part of a wider exercise to prep a report that works off several extracts.

ID Name Code Microsoft Apple Ikea
10001 Microsoft M1234
2098 Microsoft M99
30918 Apple A102
09989 Ikea I908

So I'd like to reference the ID column (which will always be unique), check to see if Microsoft appears against that ID, then return the relevant code for that.

=IFERROR(INDEX(G:G,MATCH(H1,'H:H,0)),"")

So G:G is the Name Range
H1 will be a field with the Name - Microsoft for example (there'll be a few columns with that fixed name in it so the reference there will change anyway, H2, H3, etc. to return the code for that in each column
H:H is the Code

That formula doesn't appear to work as I thought it should.

Any help much appreciated, thank you!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I haven't understood your data layout, so base something on this

With your data starting at row 2
ID in column A
Name in Column B
Code in column C

D1 is search ID
E1 is search Name

=LOOKUP(2,1/((A2:A6=D1)*(B2:B6=E1)),C2:C6)
 
Upvote 0
Is this the sort of result you are after?
+Fluff New.xlsm
GHIJKLM
1IDNameCodeMicrosoftAppleIkea
210001MicrosoftM1234M1234A102I908
32098MicrosoftM99M99
430918AppleA102
59989IkeaI908
6
Data


Also please update you account details to show what version of Excel you are using. This affects what functions you can use.
 
Upvote 0
Is this the sort of result you are after?
+Fluff New.xlsm
GHIJKLM
1IDNameCodeMicrosoftAppleIkea
210001MicrosoftM1234M1234A102I908
32098MicrosoftM99M99
430918AppleA102
59989IkeaI908
6
Data


Also please update you account details to show what version of Excel you are using. This affects what functions you can use.
Yes that's exactly it sorry I didn't make it very clear to all the posters here, I've updated my account details too.

Many thanks!
 
Upvote 0
Did you try the formula?
 
Upvote 0
Book1
ABCDEFG
1CodeCOMPANYCOMPANY IDMicrosoftAppleHP
2109898Microsoft10011001
3109898Apple999999
4787897Microsoft10021001
5787897Apple998
6896783HP567567
7897812HP568568
82456Apple997997
9762Microsoft10031003
10762Apple996996
11762HP569569
12
Sheet1


I don't think it's quite captured it, sorry I've restructured it as we have codes that appear more than once for different companies, but the company ID is what I need to capture and the vlookup will only return the first value which would be fine except there are multiples of the same field to check. Hope that makes sense, apologies for not being very clear at the start.
 
Upvote 0
When using XL2BB you need to select all the entire range, not just a single cell.
Did you try the formulae in post#3?
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,309
Members
449,080
Latest member
jmsotelo

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