Forum Discussion
Elva_Tanguerre
Oct 11, 2023Copper Contributor
Return primary value based on hierarchy
I have a list of names with groups they can belong to (one column per group). Some individuals belong to many groups but in the end, I need find their primary group, based on a hierarchy. For instanc...
PeterBartholomew1
Oct 11, 2023Silver Contributor
This does the same as mtarler except it runs through each row and it returns a group name for the numeric values as well as text.
= BYROW(groups,
LAMBDA(g, XLOOKUP(TRUE, g<>"", groupNames,""))
)The other thing is that BYROW / LAMBDA is specific to Excel 365, as is every formula I write.
- mtarlerOct 11, 2023Silver Contributornice catch on the number thing and clever use of TRUE, g<>"" to fix that.
what Elva_Tanguerre needs to know is that in your formula "groups" and "groupNames" are named ranges. They can either replace those name with the range or better yet highlight those ranges and type those names into the box to the left of the formula box to name those ranges accordingly (or highlight and right click and select Define Name, or use the Names Manager)