Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Left function with varying lengths

(0) ShareShare
ReportReport
Posted on by

I'm trying to replicate the effect of this formula from excel "LEFT(B5,FIND("-",B5)-1)" in Power Automate, where instead of cell B5 I'm referencing the Subject line of an email.

 

My trigger is every time an email is received from specific senders, I want to salvage only the left hand portion of the subject line, after a specific character, but with the left hand side being varying lengths. For example: 

             

C-Suite _ Monthly Sales report     C-Suite
Northwest Ops _ Volume ReportNorthwest Ops

 

I've tried this, but the expression is invalid

left(triggerBody()?['subject'],find("-",triggerBody()?['subject'])-1)

 

Any help would be greatly appreciated. 

  • Verified answer
    v-bofeng-msft Profile Picture
    on at
    Re: Left function with varying lengths

    Hi @Anonymous ,

     

    The point is that '-' is not a valid operator in flow , please use 'sub' instead.

     

    left(triggerBody()?['subject'],sub(find("-",triggerBody()?['subject']),1))
    
    

     

     

    Best Regards,

    Bof

  • Verified answer
    Ajinder31 Profile Picture
    530 on at
    Re: Left function with varying lengths

    Hi @Anonymous , If requirement is to get text before first underscore _ I think below expression will work fine.

    split(triggerOutputs()?['body/subject'], '_')[0]



    --------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1