Lookup and or Index Match with If Function?

Bedford

Active Member
Joined
Feb 3, 2015
Messages
316
Office Version
  1. 365
Platform
  1. MacOS
I have a workbook with 2 sheets, in sheet 2 are a list of product codes with corresponding price in 2 currencies. In sheet 1 a drop-down list of the product codes and a drop-down list of the 2 currencies.

As it is now, in sheet 1, I select the product code from a list and with the below formula I am only able to pull the “USD List” price regardless if I select “USD List” or “CAD List” because I don’t know how to write the formula to identify where to draw the data from.

=IF(ISNA(VLOOKUP(A2,'Sheet 2'!$B$2:$C$4,2,FALSE)),"",VLOOKUP(A2,'Sheet 2'!$B$2:$C$4,2,FALSE))

<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC;
}
.tableizer-table th {
background-color: #104E8B;
color: #FFF;
font-weight: bold;
}
</style>







SHEET 1
ABC
1Product CodeCurrencyPrice
2VB-444x612-2CAD List$10.00
3MM-898x728-3USD List$15.00
4

<thead>
</thead><tbody>
</tbody>


<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC;
}
.tableizer-table th {
background-color: #104E8B;
color: #FFF;
font-weight: bold;
}
</style>







SHEET 2
ABC
1Product CodeUSD ListCAD List
2VB-444x612-2$10.00$11.00
3MM-898x728-3$15.00$16.00
4MS-999x2142-1S$12.00$13.00

<thead>
</thead><tbody>
</tbody>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try changing the VLOOKUP part of your formula to:
Code:
VLOOKUP(A2,Sheet2!$A$2:$C$4,MATCH(B2,Sheet2!$A$1:$C$1,0),0)
 
Upvote 0
=IFERROR(IF(B2="cad list", VLOOKUP(A2,Sheet2!$A$1:$C$4,3,FALSE),VLOOKUP(A2,Sheet2!$A$1:$C$4,2,FALSE)),"")

Beaten to it :)

to stop the #N/A error
=IFERROR(VLOOKUP(A2,Sheet2!$A$2:$C$4,MATCH(B2,Sheet2!$A$1:$C$1,0),0),"")
 
Last edited:
Upvote 0
Try changing the VLOOKUP part of your formula to:
Code:
VLOOKUP(A2,Sheet2!$A$2:$C$4,MATCH(B2,Sheet2!$A$1:$C$1,0),0)

AhoyNC, Wayne, thank you for your help, it worked well on the simple example I had included. I actually created that sample thinking any response could be transposed to the more complicated workbook where I have the actual challenge, but that’s not the case it seems. I’ll try to explain the actual scenario if you can bare with me.

Using the response you sent, I adjusted the formula to read;

=IFERROR(VLOOKUP(J8,'Customer Product'!$A$6:$N$400,MATCH(M8,'Customer Product'!$M$1:$N$1,0),0),"")

The formula does return a result, however from the wrong column in the sheet ‘Customer Product’. The results I’m looking for, “USD List” and or “CAD List” are located in columns “M” and “N” respectively, in the Customer Product sheet. The results being returned are from columns “A” and “B”? I’m guessing the issue is with “J8” in the formula as it’s highlighted in blue, I’ve tried numerous adjustments without success.

Again, your help would be appreciated.
 
Upvote 0
Try changing your formula to:
Code:
=IFERROR(VLOOKUP(J8,'Customer Product'!$A$6:$N$400,MATCH(M8,'Customer Product'![COLOR="#FF0000"]$A$1:$N$1[/COLOR],0),0),"")
 
Upvote 0
Ok, that's amazing! Works like a charm, thank you very much again...
Doug.
 
Upvote 0

Forum statistics

Threads
1,217,097
Messages
6,134,560
Members
449,878
Latest member
Paris Dave

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