VLOOKUP an item that has more than one matching value?
What's the best way to lookup a value from one table, that has multiple matching values in another table? Or, perhaps to word it another way, to lookup a value using more than one criteria?
Let's say I have two tables, ProductSheet and DailyPrices. They look somewhat like this:
DailyPrices:
Date
SKU
Price
11-Jul-18
SOX
$5.25
11-Jul-18
BLT
$2.00
12-Jul-18
HAT
$4.00
13-Jul-18
SOX
$6.00
ProductSheet:
SKU
Current Price
SOX
=Latest price in price list
HAT
=Latest price in price list
BLT
=Latest price in price list
How can I lookup the *latest* price of an item in DailyPrices and return it as the current price in ProductSheet? I tried VLOOKUP but I believe what I'm looking to do is too complicated for VLOOKUP. I also tried a table-based query but couldn't get that to return what I needed either. Any suggestions? Thanks in advance!
Re: VLOOKUP an item that has more than one matching value?
Thanks Glenn for taking time out of your day to help me. My sample was a little simplistic, but I was able to combine what you gave me with a table-based query and get the results I'm looking for. Thank-you!
That said, could you help me understand how it works? I believe the secret sauce is in this portion:
That doesn't seem to follow the syntax for LOOKUP() in the online help, any chance you can walk me through what you've done here? Thanks again for helping me solve my problem!
LOOKUP(2
You're looking for a value = 2. There can never be one. It'll either be 1 or #DIV/0. In this case, LOOKUP will match the last numeric value found in the array, which corresponds to the last instance of a match for SOX... and
$C$2:$C$10)
return the corresponding value from C2 to C10.
The IFERROR bit returns a blank if no match is found.
If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.
It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
Digital Nomad... based in Ireland... but I could be anywhere in the world
MS-Off Ver
Office 365 for PC.
Posts
34,847
Re: VLOOKUP an item that has more than one matching value?
You're welcome.
If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.
It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
Bookmarks