Formula from input to list all outputs which data comes from a table

samzie83

New Member
Joined
Jun 7, 2016
Messages
9
InputApple
Ref No
Item 1
Item 2
1
Apple
Banana
Output
Banana
2
Berries
Coconut
Watermelon
3
Watermelon
Apple
Berries
4
Banana
Coconut
Lettuce
5
Berries
Apple
6
Lettuce
Cucumber
7
Apple
Lettuce

<tbody>
</tbody>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi, I am trying to figure out from the list on the right, how I can set an Input "Fruit" and then the Output will populate in order down the table listing all Outputs that have the Input on the same line.
 
Upvote 0
you can try PowerQuery (aka Get&Transform)

load source table into PQ
create input table and load into PQ

Ref NoItem 1Item 2InputOutput
1​
AppleBananaBananaApple
2​
BerriesCoconutCoconut
3​
WatermelonApple
4​
BananaCoconut
5​
BerriesApple
6​
LettuceCucumber
7​
AppleLettuce

then use :

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Table1),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Ref No", "Item 1", "Item 2"}, {"Ref No", "Item 1", "Item 2"}),
    #"Added Conditional Column" = Table.AddColumn(#"Expanded Custom", "Output", each if [Input] = [Item 1] then [Item 2] else if [Input] = [Item 2] then [Item 1] else null),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Conditional Column",{"Output"}),
    #"Filtered Rows" = Table.SelectRows(#"Removed Other Columns", each ([Output] <> null))
in
    #"Filtered Rows"[/SIZE]

if you change input "fruit" use Ctrl+Alt+F5 to refresh query table
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

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