Hello,
I have three columns of data. I would like to concatenate the first two columns of each row and search that result based on a variable and then return the corresponding data from the third column for the row that matches the variable.
E.g. Values in the rows going down in column 1 are A, A, A, etc., values in the rows going down in column 2 are 1, 2, 3, etc., values in the rows going down in column 3 are 10, 20, 30, etc.. If my variable is "A2" the answer would be "20". I am looking for a single formula solution. Thanks for any help you could provide.
Regards,
Ken
Why do you want to concatenate the first two columns?
Let's assume this is your data:
<b>Sheet1</b><br /><br /><table border="0" cellspacing="0" cellpadding="0" style="font-family:Verdana,Arial; font-size:10pt; background-color:#ffffff; padding-left:2pt; padding-right:2pt; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:45px;" /><col style="width:45px;" /><col style="width:45px;" /><col style="width:45px;" /><col style="width:45px;" /><col style="width:45px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td><td >C</td><td >D</td><td >E</td><td >F</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td style="text-align:center; border-style:solid; border-width:1px; border-color:#000000; ">A</td><td style="text-align:center; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">1</td><td style="text-align:center; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">10</td><td style=" border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style="text-align:center; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">A</td><td style="text-align:center; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">3</td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">A</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">2</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">20</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">A</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">3</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">30</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">B</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">1</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">40</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">B</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">2</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">50</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >6</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">B</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">3</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">60</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >7</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">C</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">1</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">70</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >8</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">C</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">2</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">80</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr><tr style="height:17px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >9</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-width:1px; border-color:#000000; ">C</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">3</td><td style="text-align:center; border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; ">90</td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td><td style=" border-right-style:solid; border-bottom-style:solid; border-width:1px; border-color:#000000; "> </td></tr></table> <br /><br />
The lookup values are in E1 and F1.
Enter this array formula in G1:
=INDEX(C1:C9,MATCH(1,IF(A1:A9=E1,IF(B1:B9=F1,1)),0))
** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.
If the value to be returned is numeric and the combination of lookup values is unique then you can use this normally entered formula:
=SUMPRODUCT(--(A1:A9=E1),--(B1:B9=F1),C1:C9)
If you're using Excel 2007 or later then you can use the SUMIFS function:
=SUMIFS(C1:C9,A1:A9,E1,B1:B9,F1)