Return all column headers where the cells are not blank

rubbis_with_excel

New Member
Joined
Jan 19, 2004
Messages
28
Hi,
I'm really struggling with a formula and I was hoping someone might be able to help.

I have a table such as this:

Name__System1__System2__System3
........................................................
Adam__100%....__0%.......__0%
Bill....__50%.....__50%......__0%
Claire__25%.....__25%......__50%

And in a separate sheet I want a formula to show each header when the relevant person's cell is not blank. Such as:

Name__Systems
........................
Adam__System1
Bill....__System1,System2
Claire__System1,System2,System3

The problem is that I can't use VBA and I can't add any columns or rows, so I need to house everything in the cell only.

Does anyone have any tidy solutions in mind?

Thanks
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Book1
ABCD
1NameSystem1System2System3
2Adam100%0%0%
3Bill50%50%0%
4Claire25%25%50%
Sheet1



Book1
ABCD
1NameSystem
2Adam1
3Bill0.50.5
4Claire0.250.250.5
Sheet2


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

=IFERROR(INDEX(Sheet1!$B$2:$D$4,MATCH($A2,Sheet1!$A$2:$A$4,0),SMALL(IF($A$2:$A$4=$A2,IF(ISNUMBER(1/Sheet1!$B$2:$D$4),IF(Sheet1!$B$2:$D$4>0,COLUMN(Sheet1!$B$2:$D$4)-COLUMN(Sheet1!$B$2)+1))),COLUMNS($B2:B2))),"")
 
Upvote 0
Such as:

Name__Systems
........................
Adam__System1
Bill....__System1,System2
Claire__System1,System2,System3

with PowerQuery

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Name[/td][td=bgcolor:#5B9BD5]System1[/td][td=bgcolor:#5B9BD5]System2[/td][td=bgcolor:#5B9BD5]System3[/td][td][/td][td=bgcolor:#70AD47]Name[/td][td=bgcolor:#70AD47]System[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Adam[/td][td=bgcolor:#DDEBF7]
100%​
[/td][td=bgcolor:#DDEBF7]
0%​
[/td][td=bgcolor:#DDEBF7]
0%​
[/td][td][/td][td=bgcolor:#E2EFDA]Adam[/td][td=bgcolor:#E2EFDA]System1[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Bill[/td][td]
50%​
[/td][td]
50%​
[/td][td]
0%​
[/td][td][/td][td]Bill[/td][td]System1,System2[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Claire[/td][td=bgcolor:#DDEBF7]
25%​
[/td][td=bgcolor:#DDEBF7]
25%​
[/td][td=bgcolor:#DDEBF7]
50%​
[/td][td][/td][td=bgcolor:#E2EFDA]Claire[/td][td=bgcolor:#E2EFDA]System1,System2,System3[/td][/tr]
[/table]


Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> 0)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Name"}, {{"Count", each _, type table}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "System", each Table.Column([Count],"Attribute")),
    #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"System", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    #"Removed Columns1" = Table.RemoveColumns(#"Extracted Values",{"Count"})
in
    #"Removed Columns1"[/SIZE]

result table can be loaded anywhere
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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