vlookup function applied to the table containing equal values

AlexIV

New Member
Joined
Jan 18, 2018
Messages
7
Hello Everyone,

I need to generate an invoice (new table) extracting data from tables 1&2 below. The input values are: Product #, Quantity and Destination.
The ouput parameters are: price per kg , discount per kg, shipping per kg, total price.
I'm trying to use vlookup function but the challenge is the product column contains the same products.

Table 1. Product pricing
Product #SAP IDProduct Ship QtyPriceDiscountEx-works price USD/kg
1111000000A1<100kg$100.00$5.00$95
1111000000A1100 -500kg$80.00$5.00$75
1111000000A1>500 kg$70.00$5.00$65
1211000001B2<100kg$56$7.00$49
1211000001B2100 -500kg$54$7.00$47
1211000001B2>500 kg$51$7.00$44
Table 2 Shipping Cost
City Cost, $/kg
NYC5
Toronto3
Seatle4
Invoice
Product# Quantity Destination Price Shipping Total price
121 50 NYC 56.36 5 3058

<tbody>
</tbody>
 
This?


Excel 2010
ABCDEFGH
1Product #SAP IDProductShip QtyPriceDiscountEx-works price USD/kg
21111000000A1<100kg$100.00$5.00$95
31111000000A1100 -500kg$80.00$5.00$75
41111000000A1>500 kg$70.00$5.00$65
5
6
71211000001B2<100kg$56$7.00$49
81211000001B2100 -500kg$54$7.00$47
91211000001B2>500 kg$51$7.00$44
10
11
12CityCost, $/kg
13NYC5
14Toronto3
15Seatle4
16
17
18Product#QuantityDestinationPriceShippingTotalprice
1912150NYC5653050
Sheet13
Cell Formulas
RangeFormula
E19=VLOOKUP(C19,$A$13:$B$15,2,0)
F19=B19*(D19+E19)
D19{=INDEX($E$2:$E$9,MATCH(LOOKUP(B19,{0,"<100kg";100,"100 -500kg";501,">500 kg"}),IF($A$2:$A$9=A19,$D$2:$D$9,0),0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
This?

Excel 2010
ABCDEFGH
1Product #SAP IDProductShip QtyPriceDiscountEx-works price USD/kg
21111000000A1<100kg$100.00$5.00$95
31111000000A1100 -500kg$80.00$5.00$75
41111000000A1>500 kg$70.00$5.00$65
5
6
71211000001B2<100kg$56$7.00$49
81211000001B2100 -500kg$54$7.00$47
91211000001B2>500 kg$51$7.00$44
10
11
12CityCost, $/kg
13NYC5
14Toronto3
15Seatle4
16
17
18Product#QuantityDestinationPriceShippingTotalprice
1912150NYC5653050

<tbody>
</tbody>
Sheet13

Worksheet Formulas
CellFormula
E19=VLOOKUP(C19,$A$13:$B$15,2,0)
F19=B19*(D19+E19)

<tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
D19{=INDEX($E$2:$E$9,MATCH(LOOKUP(B19,{0,"<100kg";100,"100 -500kg";501,">500 kg"}),IF($A$2:$A$9=A19,$D$2:$D$9,0),0))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
Brillinat!!! Took me a while to understand. It works! Thank you vey much!
 
Upvote 0

Forum statistics

Threads
1,214,825
Messages
6,121,788
Members
449,049
Latest member
greyangel23

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