Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

71%
+3 −0
Q&A How to pivot text?

In this Q a user asked for a simple way to represent this data: - PERSON 1 | PERSON 2 | YES - PERSON 1 | PERSON 3 | YES - PERSON 2 | PERSON 1 | YES - PERSON 2 | PERSON 3 | YES - PERSON 3 | PER...

2 answers  ·  posted 4y ago by pnuts‭  ·  edited 1y ago by Wicket‭

#2: Post edited by user avatar Wicket‭ · 2023-06-20T17:57:01Z (over 1 year ago)
edited tags
How to pivot text?
In this [Q](https://webapps.stackexchange.com/questions/126932/cross-comparing-values-between-two-columns-for-voting-purposes) a user asked for a simple way to represent this data:

```
- PERSON 1 | PERSON 2 | YES
- PERSON 1 | PERSON 3 | YES
- PERSON 2 | PERSON 1 | YES
- PERSON 2 | PERSON 3 | YES
- PERSON 3 | PERSON 1 | NO
- PERSON 3 | PERSON 2 | NO
```
in this format:

```
- _________| PERSON 1 | PERSON 2 | PERSON 3 |
- PERSON 1 |   X      |   YES    |    YES   |
- PERSON 2 |   YES    |   X      |    YES   |
- PERSON 3 |   NO     |   NO     |    X     |
```
This formula was offered as a solution:

>    =ARRAYFORMULA({{"";   UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")})},           {TRANSPOSE(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}));IFERROR({
              VLOOKUP(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),
 FILTER(A:C,B:B=INDEX(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),1,1)),3,0),
              VLOOKUP(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),
 FILTER(A:C,B:B=INDEX(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),2,1)),3,0),
              VLOOKUP(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),
 FILTER(A:C,B:B=INDEX(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),3,1)),3,0)},
 "X")}})

where it has been assumed the source table (unlabelled) starts in A2.

A mere copy/paste of a formula written for one is about the simplest possible solution, but, because of formatting, *just* copy pasting the above may not work. Also, without adjustment, the formula would break if ColumnsA:B were labelled, or might break in case of further content of a different nature in those columns. In addition, the question was tagged [google-sheets-query].

Is there a more memorable way to achieve the desired result, preferably using Google's Query Language?
#1: Initial revision by user avatar pnuts‭ · 2020-10-19T16:16:12Z (about 4 years ago)
How to pivot text?
In this [Q](https://webapps.stackexchange.com/questions/126932/cross-comparing-values-between-two-columns-for-voting-purposes) a user asked for a simple way to represent this data:

```
- PERSON 1 | PERSON 2 | YES
- PERSON 1 | PERSON 3 | YES
- PERSON 2 | PERSON 1 | YES
- PERSON 2 | PERSON 3 | YES
- PERSON 3 | PERSON 1 | NO
- PERSON 3 | PERSON 2 | NO
```
in this format:

```
- _________| PERSON 1 | PERSON 2 | PERSON 3 |
- PERSON 1 |   X      |   YES    |    YES   |
- PERSON 2 |   YES    |   X      |    YES   |
- PERSON 3 |   NO     |   NO     |    X     |
```
This formula was offered as a solution:

>    =ARRAYFORMULA({{"";   UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")})},           {TRANSPOSE(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}));IFERROR({
              VLOOKUP(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),
 FILTER(A:C,B:B=INDEX(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),1,1)),3,0),
              VLOOKUP(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),
 FILTER(A:C,B:B=INDEX(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),2,1)),3,0),
              VLOOKUP(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),
 FILTER(A:C,B:B=INDEX(UNIQUE({FILTER(A:A,A:A<>"");FILTER(B:B,B:B<>"")}),3,1)),3,0)},
 "X")}})

where it has been assumed the source table (unlabelled) starts in A2.

A mere copy/paste of a formula written for one is about the simplest possible solution, but, because of formatting, *just* copy pasting the above may not work. Also, without adjustment, the formula would break if ColumnsA:B were labelled, or might break in case of further content of a different nature in those columns. In addition, the question was tagged [google-sheets-query].

Is there a more memorable way to achieve the desired result, preferably using Google's Query Language?