Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Left function with varying lengths

Like (0) ShareShare
ReportReport
Posted on 30 Nov 2022 03:24:41 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 30 Nov 2022 at 05:31:32
    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 30 Nov 2022 at 04:49:28
    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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 97

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 70 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard
Loading started