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 Apps / Extract first/last nam...
Power Apps
Answered

Extract first/last name from an email address

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a formula that is extracting the first and last name from an email address.

Substitute(First(Split(glry_Email_Approval_from_mainform.Selected.FVP_Level3, "@")).Result,"."," ")

 

Now i need to do 2 things:

Formula to extract just the first name

and

formula to extract just the last name 

Please.

 

Thanks

dave

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    How are you distinguishing the first and last name delimiter?  For example, lets say your email address is your full name - DavidPowell - How would you determine what is first and what is last?

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes 

    good question...

    have to take the 80/20 rule and assume a space.

    dave

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    If you are assuming a space, then your formula would be:

    With(First(Split(glry_Email_Approval_from_mainform.Selected.FVP_Level3, "@")),
     {
     FirstName: First(Split(Result, " ")).Result,
     LastName: Last(Split(Result, " ")).Result
     }
    )

    Of course...there are a lot of assumptions in the email having a space and also that it is truly just a first and last name.

    The above produces a record with both first and last name columns in it.

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes ,

    Can this formula be used inside  a "Patch" statement ?

     

    Patch(t_redbook_sp_ActivityCollection,LookUp(t_redbook_sp_ActivityCollection, RBP_MASTER_ID = Value(RBK_EscalationId_txt.Text)),
    { FUNCVP_EMAIL_ADDRESS: RBK_FVP.Text,
    FUNCVP_FIRST_NAME: With(First(Split(glry_Email_Approval_from_mainform.Selected.FVP_Level3, "@")),
    {
    FirstName: First(Split(Result, " ")).Result,LastName: Last(Split(Result, " ")).Result
    }
    )


    }

    )

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Sure...

     

    With(
     With(First(Split(glry_Email_Approval_from_mainform.Selected.FVP_Level3, "@")),
     {
     FirstName: First(Split(Result, " ")).Result,
     LastName: Last(Split(Result, " ")).Result
     }
     ),
    
     UpdateIf(t_redbook_sp_ActivityCollection,
     RBP_MASTER_ID = Value(RBK_EscalationId_txt.Text),
     { FUNCVP_EMAIL_ADDRESS: RBK_FVP.Text,
     FUNCVP_FIRST_NAME: FirstName,
     FUNCVP_LAST_NAME(assumed): LastName
     }
     )
    )
    

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    ok for the first name i did this :

    First(Split(glry_Email_Approval_from_mainform.Selected.FVP_Level3, ".")).Result

     

    for the second name i did this :

    Left(Right(glry_Email_Approval_from_mainform.Selected.FVP_Level3,Len(glry_Email_Approval_from_mainform.Selected.FVP_Level3)-Find(".",glry_Email_Approval_from_mainform.Selected.FVP_Level3)),Find("@",Right(glry_Email_Approval_from_mainform.Selected.FVP_Level3,Len(glry_Email_Approval_from_mainform.Selected.FVP_Level3)-Find(".",glry_Email_Approval_from_mainform.Selected.FVP_Level3)))-1)

     

    dave

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    ?? why all of that?  I provided a formula that will give you first and last name!!??

     

    If you are now stating that the first/last name is separated by a period, then just change that in the formula.

    With(
     With(First(Split(glry_Email_Approval_from_mainform.Selected.FVP_Level3, "@")),
     {
     FirstName: First(Split(Result, ".")).Result,
     LastName: Last(Split(Result, ".")).Result
     }
     ),
    
     UpdateIf(t_redbook_sp_ActivityCollection,
     RBP_MASTER_ID = Value(RBK_EscalationId_txt.Text),
     { FUNCVP_EMAIL_ADDRESS: RBK_FVP.Text,
     FUNCVP_FIRST_NAME: FirstName,
     FUNCVP_LAST_NAME(assumed): LastName
     }
     )
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @RandyHayes , 

    I was just working on it while waiting for a response.

    will use your code...and Thanks !!

     

    Dave

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Oh...gotcha.  You had me wondering there for a moment. 😉 Glad that worked.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard