Forum Discussion
bjerniganpca
Mar 27, 2023Copper Contributor
Sorting last names alphabetically but keeping together by family ID if last name differs
I have a list of families and each family has a unique identifier called Family ID. I want to sort the list alphabetically but keep each family together. Some families do not share the same last na...
- Mar 29, 2023
This is a reasonably simple Excel 365 formula
= LET( leadName, XLOOKUP(ID, ID, Name), SORTBY(Tabelle, leadName) )
All it does is identify the first occurring name associated with each ID and sorts on that.
bjerniganpca
Mar 29, 2023Copper Contributor
Thank you everyone for the help! Peter, I could not get your formula to work (what is Tabelle?). However you pointed me to the answer. I just made a new column called "Last Name for Sort" and did an xlookup to Family ID to pull the first last name found on each Family ID. Then I sorted by that field. Thank you all!
PeterBartholomew1
Mar 29, 2023Silver Contributor
I had picked up NikolinoDE 's workbook with its German language flavour. I used the defined name 'Tabelle' to apply to the entire table. Niko previously had that as a sheet name but I wanted it more specific to the data.
BTW. My formula does not sort the source data in place, instead it creates a dynamic array sorted as you specified. Anyway it is good that you have what you require.