Home > other >  Find the highest value and return adjacent cell until value changes in another cell
Find the highest value and return adjacent cell until value changes in another cell

Time:11-20

I am an excel novice, so I hope I am explaining my problem well enough:

enter image description here

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)
)

Here is the output: sample excel file

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.

  • Related