web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to swap "Last name...
Power Automate
Answered

How to swap "Last name, First name middle initial" to "First name middle initial Last name" for a column with multiple people entries?

(1) ShareShare
ReportReport
Posted on by 27

Greetings,

 

I have a people column with multiple entries, no entries, or single entries per "cell".  The DisplayName format for system generated lookups is Last Name, First Name Middle initial (and more if it's needed for other names for a single person) I need to swap each of those people names around such that it's First Name Middle Initial (and whatever other names in the middle) then Last Name.

 

I found this:  https://powerusers.microsoft.com/t5/Building-Flows/Change-display-name-to-first-then-last-name/td-p/876327

 

But I believe that's assuming a single name in said "cell" of a SharePoint list that it's coming from.

 

This is my current flow that accumulates the name values as last name first, first name m.i.  

 

mcgeeks_0-1701988613688.png

 

As it's near the end of my week I'm going to put the flow back to operational state and try again Monday.

 

If I can get a solution to this particular part that works I can implement it from there with the rest of the flow I've built.  As well as implement it for 4 people columns as well.

 

Hmmm...  I wonder if I could just add the blocks from the link shared above below my flow snippet?  That could be my solution.  Where I'm joining the Main Customer names I'm using a semicolon as the people separator.  So the split and flip from that solution might work using the comma space as a separator for the last name, first name m.i.....  I'll give that a go Monday.  If you agree this should work, or think you have a better solution, I'm certainly glad to hear it!

 

Thanks in advance,

McGeeks

It's like McDonald's, but for a computer nerd!  Ha!

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @mcgeeks 

     

    So you have a comma between like

     

    Smith, David H

     

    So you want David H Smith.

     

    Please give me an example of the name you having.

     

    Thanks

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @mcgeeks 

     

    Please see below steps:

     

    Here I am checking IF middle name present or not.

     

    image.png

     

    Expression in the order are:

     

    Compose 2

    split(outputs('Compose'), ' ')
     
    If condition left side expression
    outputs('Compose_2')?[2]
     
    Compose 3
     
    outputs('Compose_2')?[1] outputs('Compose_2')?[2] first(split(outputs('Compose_2')?[0], ','))
     
    Compose 4
     
    outputs('Compose_2')?[1]  first(split(outputs('Compose_2')?[0], ','))
     
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    Hopefully this is what you're after. Assuming your Display Name is always in the format Last Name, First Name Initials.

     

    For this example, I have the following list item that has a multi-select Person column.

    grantjenkins_1-1702220132539.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_2-1702220187148.png

     

    I'm not sure what your trigger is, so I've just got a Manual flow and used Get item to retrieve the list item.

    grantjenkins_3-1702220253031.png

     

    Select uses the Owners from Get item and the following expression to swap the names around.

    concat(
     trim(last(split(item()?['DisplayName'], ','))),
     ' ', 
     first(split(item()?['DisplayName'], ','))
    )

    grantjenkins_4-1702220318226.png

     

    Join users the output from the Select and joins by semi-colon.

    grantjenkins_5-1702220353065.png

     

    After running the flow, we would have the following output.

    grantjenkins_6-1702220435169.png

  • SM-15101351-0 Profile Picture
    27 on at

    I still have some work to do, but this is probably my fix, thanks for that.  I am running into errors when initially trying it though.  If say the cell is blank of names, I get an error.  If the cell contains one name, error.  It's looking for an array and getting a string.  I'll work that out.  I'll create logic to catch each scenario and handle it appropriately.  Thanks.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    I just tried it with multiple users selected, a single person selected, and no persons selected (blank) and all work as expected. If it's a multiselect Person column then it will always come back as an array even if single user or no user.

     

    It should work for each of the rows below.

    grantjenkins_0-1702393953768.png

     

    Are you able to show the error you are getting?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 411

#2
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 291

Last 30 days Overall leaderboard