Swap first and last name

Discuss the spreadsheet application
Post Reply
briansimmons2112
Posts: 1
Joined: Wed Jul 28, 2021 5:49 am

Swap first and last name

Post by briansimmons2112 »

In my spreadsheet, I have a column of names written as last name then a space then a first name and sometimes another space then middle initial. Is there a way to put the last names on the other side of the first name and middle initial so it reads as first name, space, middle initial, space, last name?
Open Office 4.1.10 on Windows 10
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Reversal of text in a column

Post by robleyd »

One way of doing it - with the name in A1, put this formula in B1;

Code: Select all

=TRIM(MID(A1;SEARCH(" ";A1)+1;LEN(A1)))&" "&LEFT(A1;SEARCH(" ";A1)-1)
The attached file contains some extra columns that may help you understand the whole formula if necessary.
name_reverse.ods
(20.68 KiB) Downloaded 95 times
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply