Table:
0
A
B
C
D
1
name
friend
year
person friend
2
Alice
Bob
10
3
Zach
Dan
12
4
Bob
Zach
5
5
Zach
Alice
6

Questions and formulas:
Question: What are the names of everybody who has exactly one friend?
Formula: LET(query1,SUMMARIZE(A1,DCOUNTX(B1)),FILTER(query1,CHOOSECOLS(query1,3)=1))
Formula2: LET(query1,SUMMARIZE(A2:A5,DCOUNTX(B2:B5)),FILTER(query1,CHOOSECOLS(query1,3)=1))
Level: hard
Question: Name of the people with one friend.
Formula: LET(query1,SUMMARIZE(A1,DCOUNTX(B1)),FILTER(query1,CHOOSECOLS(query1,3)=1))
Formula2: LET(query1,SUMMARIZE(A2:A5,DCOUNTX(B2:B5)),FILTER(query1,CHOOSECOLS(query1,3)=1))
Level: hard
Question: The name of the person who has one friend.
Formula: LET(a,HSTACK(A1,D1),b,D1,c,CHOOSECOLS(LET(query1,SUMMARIZE(D1,DCOUNTX(B1)),FILTER(query1,CHOOSECOLS(query1,3)=1)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Formula2: LET(a,HSTACK(A2:A5,D2:D5),b,D2:D5,c,CHOOSECOLS(LET(query1,SUMMARIZE(D2:D5,DCOUNTX(B2:B5)),FILTER(query1,CHOOSECOLS(query1,3)=1)),1),UNIQUE(FILTER(a,NOT(ISNA(XLOOKUP(b,c,c))))))
Level: hard