Return values based on Yes or No responses where Pivot is not possible

proreq

New Member
Joined
Jul 29, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I am trying to populate values based on the response 'No' from a survey results table. I am trying to get a report that gives me the name of the person first followed by question ID and the comment if he said No. Below is a table representation of what I am trying to achieve. I have tried all sorts of things and was just wondering if I am trying something that is not possible on Excel. Could anyone confirm the possibility of this please.

I have a table that looks like this

IDJackJack1Jack2DonDon1Don2AbeAbe1Abe2
1​
YesNAYesNANoTest comment
2​
YesNANoTest commentNoTest comment
3​
YesNAYesNAYesNA
4​
YesNANoTest commentYesNA
5​
YesNAYesNANoTest comment

and I am trying to get a report that looks something like this

Jack
Don
2​
Don2
4​
Don2
Abe
1​
Abe2
2​
Abe2
5​
Abe2
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
is it acceptable?

IDCustom.1Custom.2Custom.3Custom.4
1AbeAbe2
2DonDon2AbeAbe2
4DonDon2
5AbeAbe2
 
Last edited:
Upvote 0
Yes, thanks for your response.

Although, the below table would be perfect.

Clone of March 2020 BGRP
IDCustom1Custom2
1​
AbeAbe2
2​
DonDon2
2​
AbeAbe2
4​
DonDon2
5​
AbeAbe2
 
Upvote 0
Also, I was trying to populate the comments in the 3rd column. Below is an example.


IDCustom1Custom2
1​
AbeTest comment (1 - Abe2)
2​
DonTest comment (2 - Don2)
2​
AbeTest comment (2 - Abe 2)
4​
DonTest comment (4 - Don4)
5​
AbeTest comment (5 - Abe2)
 
Upvote 0
with Power Query aka Get&Transform

IDJackJack1Jack2DonDon1Don2AbeAbe1Abe2IDCustom.1Custom.2
1YesNAYesNANoTest comment1AbeAbe2
2YesNANoTest commentNoTest comment2AbeAbe2
3YesNAYesNAYesNA2DonDon2
4YesNANoTest commentYesNA4DonDon2
5YesNAYesNANoTest comment5AbeAbe2

Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Unpivot = Table.UnpivotOtherColumns(Source, {"ID"}, "Attribute", "Value"),
    Filter = Table.SelectRows(Unpivot, each ([Value] = "No" or [Value] = "Test comment")),
    Group = Table.Group(Filter, {"ID"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "Custom", each [Count][Attribute]),
    Extract = Table.TransformColumns(List, {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    Len = Table.AddColumn(Extract, "Length", each Text.Length([Custom]), Int64.Type),
    Min = List.Min(Len[Length])+1,
    SplitPos = Table.ExpandListColumn(Table.TransformColumns(Len, {{"Custom", Splitter.SplitTextByRepeatedLengths(Min), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Custom"),
    SortLen = Table.Sort(SplitPos,{{"Length", Order.Descending}}),
    Split = Table.SplitColumn(SortLen, "Custom", Splitter.SplitTextByAnyDelimiter({","}, QuoteStyle.Csv)),
    SortID = Table.Sort(Split,{{"ID", Order.Ascending}, {"Custom.1", Order.Ascending}}),
    TSC = Table.SelectColumns(SortID,{"ID", "Custom.1", "Custom.2"})
in
    TSC
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,033
Members
448,940
Latest member
mdusw

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