Priorities in Excel

samlim1014

New Member
Joined
Feb 1, 2019
Messages
1
Hi everyone,

I have a data set like the following.
Unfortunately, my data is a lot more complex than this so a simple Pivot won't let me analyse it :(

[TABLE="width: 500"]
<tbody>[TR]
[TD]Name/Year[/TD]
[TD]Apples?[/TD]
[TD]2016[/TD]
[TD]2017[/TD]
[TD]2018[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD][/TD]
[TD]Apples[/TD]
[TD]Apples[/TD]
[TD]Oranges[/TD]
[/TR]
[TR]
[TD]Emma[/TD]
[TD][/TD]
[TD]Apples[/TD]
[TD]Apples[/TD]
[TD]Apples[/TD]
[/TR]
[TR]
[TD]Dave[/TD]
[TD][/TD]
[TD]Oranges[/TD]
[TD]Apples[/TD]
[TD]Oranges[/TD]
[/TR]
</tbody>[/TABLE]

How can I show in the first Column that John liked Apples in 2016 and 2017. I don't mind concatenations eg 2016Apples2017Apples; just can't seem to figure out how. :/

Hope this makes sense. Thank you.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Would something like this work for you?

This will return the years which have Apples.

=TEXTJOIN(", ", TRUE, IF(C2:E2="Apples", $C$1:$E$1, ""))

This is an array so enter with Ctrl, Shift and Enter.
 
Last edited:
Upvote 0
or PowerQuery with PivotTable

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Name/Year[/td][td=bgcolor:#5B9BD5]2016[/td][td=bgcolor:#5B9BD5]2017[/td][td=bgcolor:#5B9BD5]2018[/td][td][/td][td=bgcolor:#DDEBF7]Name/Year[/td][td=bgcolor:#DDEBF7]Value[/td][td=bgcolor:#DDEBF7]Attribute[/td][td][/td][td]or[/td][td=bgcolor:#DDEBF7]Name/Year[/td][td=bgcolor:#DDEBF7]John[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]John[/td][td=bgcolor:#DDEBF7]Apples[/td][td=bgcolor:#DDEBF7]Apples[/td][td=bgcolor:#DDEBF7]Oranges[/td][td][/td][td]Dave[/td][td]Apples[/td][td]2017[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]Emma[/td][td]Apples[/td][td]Apples[/td][td]Apples[/td][td][/td][td][/td][td]Oranges[/td][td]2016[/td][td][/td][td][/td][td=bgcolor:#DDEBF7]Value[/td][td=bgcolor:#DDEBF7]Attribute[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Dave[/td][td=bgcolor:#DDEBF7]Oranges[/td][td=bgcolor:#DDEBF7]Apples[/td][td=bgcolor:#DDEBF7]Oranges[/td][td][/td][td][/td][td][/td][td]2018[/td][td][/td][td][/td][td]Apples[/td][td]2016[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td]Emma[/td][td]Apples[/td][td]2016[/td][td][/td][td][/td][td][/td][td]2017[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]2017[/td][td][/td][td][/td][td]Oranges[/td][td]2018[/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]2018[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td]John[/td][td]Apples[/td][td]2016[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]2017[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td]Oranges[/td][td]2018[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name/Year"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"[/SIZE]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
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