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 / Split First Name and L...
Power Automate
Answered

Split First Name and Last Name of User Name in Power Automate Desktop

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, Can someone help me with the following question?

I would like to Split the Username as First Name and Last Name. However, I am stuck when the user has more than 2 words in the Name.

For Example: Username = Master the Art

I prefer

First Name - Master

Last Name - The Art ( Last name should be after the First word of the username irrespective of number of words the user name has)

 

Currently, This is how I tried but it works only when the Employee Name has '3' words in it. However, I need the Employee's Last name should be "The Art"

Few more examples are..

Employee Name - Chair has Four legs

First Name - Chair; Last Name - has Four legs

 

Employee Name - Water Purifier

First Name - Water; Last Name - Purifier

 

RRP_0-1661772292852.png

 

I have the same question (0)
  • Verified answer
    wnzn Profile Picture
    168 on at

    Funny employees you have. 🙂

     

    If you are working with a TextList with a variable amount of items, you can use a for each loop to go through each of them and use the Set variable action in that for each loop to update the last name variable for each item. The first name can still be done before the for each loop as it is currently: "TextList[0]". Take a look at this to get an idea: For each loop actions - Learn | Microsoft Docs

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Use Parse Text to get the position of the first space; ensure you use the "First occurrence only" option.

    Notice, to find a space is %' '% ; note the space is in between the apostrophes.

    MichaelAnnis_0-1661785036282.png

    Get subtext from start to the Position number found above for the first name:

    MichaelAnnis_3-1661785235131.png

    Get subtext from %Postition + 1% to the end of text for the last name:

    MichaelAnnis_4-1661785261782.png

     

    That's how to split it.  You will need to create two new lists or a datatable to keep the records, because when you throw this into a loop, these variables will be overwritten, so:

     

    Start with employeename list

    Create List %FirstNames%

    Create List %LastNames%

    For each %CurrentItem% in %EmployeeNames%

        ~Do the above

        Add %FirstName% to %FirstNames%

        Add %LastName% to %LastNames%

    End (For each)

     

    Then you will have two lists that are in the same order.

     

    Good luck!

     

     

     

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard