I am an excel novice, so I hope I am explaining my problem well enough:
CodePudding user response:
You can try this in cell E2
:
=LET(rng, A2:C19, dists, INDEX(rng,,1), names, INDEX(rng,,2),
pcts, INDEX(rng,,3),
distsUx, UNIQUE(dists),
result, MAP(distsUx, LAMBDA(dist,
TEXTJOIN(",",,FILTER(names, (dists=dist)
* (pcts = MAX(FILTER(pcts, dists=dist)))))
)),
HSTACK(distsUx, result)
)
Note: In case there is more than one name within the same district with the same max pct
, it returns the names delimited by comma.