Returning a value for two lookup columns (without a concatenate)

JMatBoS

New Member
Joined
Nov 26, 2015
Messages
3
I have a lookup table of this format:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Apples, Pears, Watermelons[/TD]
[TD]Green[/TD]
[TD]123[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Apples[/TD]
[TD]Red[/TD]
[TD]456[/TD]
[/TR]
</tbody>[/TABLE]

I need the data represented in the target table as below. Column A can contain multiple values that will appear as separate row names in the target table. Column B will have single values which will match the column names in the target table.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Green[/TD]
[TD]Red[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Apples[/TD]
[TD]123[/TD]
[TD]456[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Watermelons[/TD]
[TD]123[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


I can use a vlookup with wildcard to get the value for column A but I'm struggling to add the match to column B.

Thanks in advance[TABLE="width: 500"]
<tbody>[TR]
[TD]456[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Maybe something likes this: =SUMPRODUCT((ISNUMBER(SEARCH($A2,$A$1:$A$2)))*(B$1=$B$1:$B$2)*$C$1:$C$2)
 
Upvote 0
Let's A:C of Sheet1 house the data.

In B2 of Sheet2 enter, copy across, and down:

=SUMIFS(Sheet1!$C$1:$C$2,Sheet1!$A$1:$A$2,"*"&$A2&"*",Sheet1!$B$1:$B$2,B$1)
 
Upvote 0
Thanks. Unfortunately the facts aren't actually numeric. They are actually names. Replace 123 with Mr X and 456 with Mrs Y
 
Upvote 0
Thanks. Unfortunately the facts aren't actually numeric. They are actually names. Replace 123 with Mr X and 456 with Mrs Y

So you learned something valuable...

In B2 of Sheet2 control+shift+enter, not just enter, copy across, and down:

=IFERROR(INDEX(Sheet1!$C$1:$C$2,MATCH("*"&$A2&"*",IF(Sheet1!$B$1:$B$2=B$1,Sheet1!$A$1:$A$2),0)),"")
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top