Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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?

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
Lookup Formula: Return 1st match, then 2nd match, then 3rd match Scott Excel Discussion (Misc queries) 4 December 11th 09 05:50 AM
Filer for unique records and return all column data for unique rec bseeley Excel Discussion (Misc queries) 1 September 12th 09 12:17 AM
how can we get unique values in match function for same match key. Xcel[_2_] Excel Worksheet Functions 11 December 7th 07 08:13 PM
How do I match unique identifiers on two Excel worksheets? Randi Hagen,--Flagler College Excel Discussion (Misc queries) 1 February 3rd 06 03:00 PM
Adding Items to a ListBox-Unique Items Only jpendegraft[_14_] Excel Programming 2 May 2nd 04 02:27 AM


All times are GMT +1. The time now is 03:28 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"