Can I reorder names by last name without having to put last names first?

I have a whole list of names, but I hadn’t thought that I would need to put them in order like this, so I put last name after first. I don’t want to have to go through the whole process of moving the names around just so I can reorder them. I’m doing this in LibreOffice Writer, not in the spreadsheets.

How’s your list organised: in a table with separate columns for first and last name? As a list with the compound name as paragraph content?

In the second case, there’s no hope unless you rework your data. However, you may try to export the list as plain text, replace the space between names with semicolon (don"t know if is really necessary) in an editor and import it into Calc, telling the import filter which separator you used. You can sort any way you like and reimport into Writer as a table.

PS: I took the liberty to change the tags because common applies to all LO components, not only Writer.

I too had a problem sorting by last name. I am doing this in a Libre Office text document. I found the following worked:
I copied a list of first and last names from a Calc file and pasted them into a Text document as Paste— unformatted text. I now had a column of first and last names but not alphabetized by the last (family) name. I selected this column (basically a series of name paragraphs), went to Tools, Sort. I left Key 1 unchecked, went to Key2, checked it and set column to “2” and ascending etc as wished. In Direction went to Rows and Character and selected blank. Clicked OK and the names were all reorganized as by last name. If a list is what you want that is it. If you wish to put in a longitudinal way (such as a theatre program) you need to use the delete key one by one to move the name up one line. Do not forget to put a comma after each name.

Done and now I am smiling.

Since there isn’t an assured format like
<name> ::= <firstname><onespace><lastname>
including an assertion of “no spaces inside one of the names”, I wouldn’t smile without having learnt that compound names are no data at all.
What about

George Herbert Walker Bush  
L. Ron Hubbard
Kim Yo-jong
Muhammad bin Raschid Al Maktum

There are lots of complicated names, there is no reliable format for giving them as compounds, and there is no generally applicable way to get sorting keys from them. I would assume, in 2022 there is hardly a place in the world where I wouldn’t have to consider how to treat complicated or uncommonly written names or names originating in different cultures.

We may write names in whatever way we like, but as soon as a need of sorting comes into sight, we should consider to treat names as data in a suitable way.

Lists of 10 are no problem, of course. Lists of hundreds are.


I add to that that the notion of name is highly culture- and time-dependent. The distinction between last name and first name assumes a US context. In some countries we have surname and given names, independent of position. And other designations may be used for these (family name, inherited name, …).

Portions may be completely lacking. A former younger colleague of mine (this is not XIXth century story or older but end of XXth century) who was born in India had no given/first name, only a multiple word “family” name. This caused a lot of administrative problems because one of the words was randomly chosen as first name and this was never the same across occasions!

Also the way you introduce yourself changed in time. Taking the example of XIXth century France, people used to introduce as Family Given 1 Given2 and they would be addressed as Given2. This usage changed starting around 1900 to the contemporary Given1 Given2 Family where the call name is Given1. To make things complicated the change didn’t start simultaneously everywhere and proceeded with differing paces over the country. This means that given an identity “N1 N2 N3 N4” during the transition period, you can’t easily guess if N1 or N4 is the “surname” when it can be used also as a given name. And even now, you can’t always discriminate between an administrative designation “Surname Given” or a more informal one “Given Surname” in written papers.

1 Like

Just set column 2 for Key 1.

By the way: You can’t uncheck Key 1, if there is no other Key checked.

Thank you Lupp and ajlittoz for your input.
I do, indeed, recognize the difficulties in separating names and also the wide variety of naming systems over the world. This does not even touch the question of different script systems. Oh what a can of worms…There is no simple answer but this does offer a solution where two names are used. Again, some multi part names will show up but IF they are a small proportion they can be handled by hand. My own family was Irish based in the 1700’s and two family names were combined but separate and sometime in the 1800’s a hyphen was added to maintain both names. Names with a hyphen or some other non blank space will work with this approach. For the needs I mentioned this has been a solution that made me smile… after a lot of hard searching, trying, etc.

As I said, this is not a grand solution for all circumstances, but rather a method for one. For added confusion consider that the tendency of people to wish to have a reference to themselves as all sorts of gender, or non-gender, designations. This on top of people who have to have a Title before or designation after their name. Being politically correct and not offending someone is getting ever harder.

Cheers and smile

1 Like

Thanks Leroy. Yes I hit Key 2 first and then unchecked 1, for jut that reason. Nice to know that Key one works too. Wonder why this whole routine is not explained anywhere (as far as I can see).
Well….it is now.

@Martin_Archer-Shee: don’t use answers for what is in fact comments and feedback. You confuse users: the home page shows the total number of “solutions”, i.e. answers. And this leads users to believe there are several ways to fix the problem.
Please, reformulate your “non-answers” as comments, then delete them.

Thanks for the note. I am new to the site and mistook the one bright button as the only reply/answer system.

1 Like

I used this a year ago and it worked fine. Today I needed to sort a similar list of first and last names and it did not work. I even had written a note to myself and followed it religiously. It did not work.What has changed? Did I upgrade to a later Libre Office?? Anyone have an answer on how to sort this out. I am using a Mac.

Edit your comment, and share a sample document with two or three lines to test.