ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I match 2 items in excel to return a unique value? (https://www.excelbanter.com/excel-programming/438870-how-do-i-match-2-items-excel-return-unique-value.html)

stumped

How do I match 2 items in excel to return a unique value?
 
For example, how do I match product codes and warehouses to return an unique
price?

JLGWhiz[_2_]

How do I match 2 items in excel to return a unique value?
 
It is a lot easier to answer a question like that if the rows and columnns
data is provided. After all, nobody on this side of the server can see
your worksheet.


"Stumped" wrote in message
...
For example, how do I match product codes and warehouses to return an
unique
price?




Ryan H

How do I match 2 items in excel to return a unique value?
 
You are way to vague with your post. We need more details of what you are
trying to accomplish.
--
Cheers,
Ryan


"Stumped" wrote:

For example, how do I match product codes and warehouses to return an unique
price?


Jacob Skaria

How do I match 2 items in excel to return a unique value?
 
With data arranged as below and the query product code and Ware house in
cells D1 and D2 respectively try the below array formula..

Col A Col B Col C
P.Code WHouse Price
10001 A 12.5
10001 B 13.5
10002 A 15
10002 B 16
10003 A 8
10003 B 9

An array formula can perform multiple calculations and then return either a
single result or multiple results. You create array formulas in the same way
that you create other formulas, except you press CTRL+SHIFT+ENTER to enter
the formula. If successful in 'Formula Bar' you can notice the curly braces
at both ends like "{=<formula}"

=INDEX($C$2:$C$9,MATCH(1,($A$2:$A$9=D2)*($B$2:$B$9 =D3),0))

If you are looking for a VBA solution try the below

Sub Macro()
Dim varPCode As Variant
Dim varWHouse As Variant

varPCode = 10001
varWHouse = "B"

MsgBox Evaluate("INDEX($C$3:$C$10,MATCH(1," & _
"($A$3:$A$10=" & varPCode & ")*($B$3:$B$10=""" & varWHouse & """),0))")

End Sub


--
Jacob


"Stumped" wrote:

For example, how do I match product codes and warehouses to return an unique
price?



All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com