#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default vlookup 2 fields

I have 3 columns of data. Column A is part numbers. Column B is a qty
and Column C is a price. It is sorted alpha and there can be many of
the same part #'s.. What I want to do is look up a part number (lets
say #1) and then my VLOOKUP will only look in the rows that contain 1
as the Part# and lookup the QTY and bring me back a price. For
instace, I have a Part# of 1, and a Qty of 10, so I want to bring pack
the price of 100. I don't know if I need 2 vlookups, and INDEX, a
MATCH or what.

Please help. Chris
Part# qty price
1 2 20
1 5 50
1 10 100
1 20 200
1 30 300
1 50 500
2 2 20
2 5 50
2 10 100
2 20 200
2 30 300
2 50 500

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 751
Default vlookup 2 fields

On Mar 5, 7:37 pm, wrote:
I have 3 columns of data. Column A is part numbers. Column B is a qty
and Column C is a price. It is sorted alpha and there can be many of
the same part #'s.. What I want to do is look up a part number (lets
say #1) and then my VLOOKUP will only look in the rows that contain 1
as the Part# and lookup the QTY and bring me back a price. For
instace, I have a Part# of 1, and a Qty of 10, so I want to bring pack
the price of 100. I don't know if I need 2 vlookups, and INDEX, a
MATCH or what.

Please help. Chris
Part# qty price
1 2 20
1 5 50
1 10 100
1 20 200
1 30 300
1 50 500
2 2 20
2 5 50
2 10 100
2 20 200
2 30 300
2 50 500


Part# in F1, Qty in G1:
=INDEX(C1:C100,MATCH(F1&G1,A1:A100&B1:B100,0))

This is an array formula, thus commit with Shift+Ctrl+Enter.

HTH
Kostis Vezerides

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default vlookup 2 fields

If you want exact matches for just two columns (and return a value from a
third), you could use:

=index(othersheet!$c$1:$c$100,
match(1,(a2=othersheet!$a$1:$a$100)*(b2=othersheet !$b$1:$b$100),0))

(all in one cell)

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

Adjust the range to match--but you can only use the whole column in xl2007.

This returns the value in othersheet column C when column A and B (of
othersheet) match A2 and B2 of the sheet with the formula.

And you can add more conditions by just adding more stuff to that product
portion of the formula:

=index(othersheet!$d$1:$d$100,
match(1,(a2=othersheet!$a$1:$a$100)
*(b2=othersheet!$b$1:$b$100)
*(c2=othersheet!$c$1:$c$100),0))

wrote:

I have 3 columns of data. Column A is part numbers. Column B is a qty
and Column C is a price. It is sorted alpha and there can be many of
the same part #'s.. What I want to do is look up a part number (lets
say #1) and then my VLOOKUP will only look in the rows that contain 1
as the Part# and lookup the QTY and bring me back a price. For
instace, I have a Part# of 1, and a Qty of 10, so I want to bring pack
the price of 100. I don't know if I need 2 vlookups, and INDEX, a
MATCH or what.

Please help. Chris
Part# qty price
1 2 20
1 5 50
1 10 100
1 20 200
1 30 300
1 50 500
2 2 20
2 5 50
2 10 100
2 20 200
2 30 300
2 50 500


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! PSSSD Excel Worksheet Functions 2 August 8th 06 09:31 PM
Vlookup for non-unique fields EdwardG Excel Discussion (Misc queries) 0 May 13th 06 09:17 AM
number of fields in the row fields in pivot table UT Excel Discussion (Misc queries) 0 April 13th 06 01:17 AM
Form Fields mcaalcorn Excel Discussion (Misc queries) 0 March 3rd 06 11:06 AM
Need pie chart with number of fields instead of info in fields Lloyd Pratt Charts and Charting in Excel 1 September 21st 05 11:56 PM


All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"