Excel custom aphlabetical sort not working properly

Occasional Contributor

I'm trying to sort a big list of names first by last name,  then by first name.  I'm finding that some of the sort is not accurate. I colored the cells only for easier viewing of the inaccurate sort. I have tried over and over, and different ways.  I need some help! 


11 Replies

There may be leading or trailing spaces in the First Name and/or Last Name columns.

  • @Patrick2788 we checked for spaces & made sure nothing was "hidden"


Check again with LEN().




If last name is in column A 

In an empty cell put this formula

=A173  = A174   (compare the yellow cells to the white)


The result must be true









It comes back as false.
I've never used LEN() Can you explain more?

So it's not the same text !


I think there a space after the text

Check the 2 cells


2023-03-22 21_31_29-Greenshot image editor.png



best response confirmed by nicole82 (Occasional Contributor)


The attached workbook is a re-creation of the sort issue you have in your workbook. There's also a LEN example.

Okay, thanks that worked great!
You're welcome! Glad it's working.