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 make this logic...
Power Automate
Answered

How to make this logic in IF statement work

(0) ShareShare
ReportReport
Posted on by 170

Hello everyone,

 

This is more of a logic question instead of a PAD question but I have been trying and am not being able to make this work.

I have two different types of dates that are stored as text, the dates either look like this

"14-16 June 2022"

"11-12 May 2022"

Or they look like this

"25 January-16 April 2022"

"15 September-17 July 2020"

 

The dates are written in different formats so they require different manipulation to turn them into the desired format, I already have the actions I want to make on each set of dates. What I am not being able to do is write the correct IF condition to differentiate between the type of date passed from the two above.

 

If anyone could help that would be really great.

 

Thanks in advance everyone

 

Telmo Ferreira

 

I have the same question (0)
  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    I think 

    first split the above dates using -

    for

    "14-16 June 2022"

    "11-12 May 2022"

    use regex and separate month and year then join with the date 14 and 11

    25 January-16 April 2022"

    "15 September-17 July 2020"

    for the above the dates also split with - and take year separately and join again

     

     

     

  • TelmoERF96 Profile Picture
    170 on at

    I already have that logic working, maybe I didn't make myself clear I am sorry.

    I want someone to help me write the IF statement so when I pass it the date, the logic of the if checks if it is the first type of date or the second one.

  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    UshaJyothi20_0-1697019278223.png

    UshaJyothi20_1-1697019344785.png

    Hope this helps

    Usha

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    There are essentially a few ways in which you can do this:

    1. You can just try to convert it via one approach and then have error handling in place to attempt the other approach if the first one fails.
    2. You can also use Parse text with regex to check for \d+-\d+. This will return a match for the dates that are formatted as "14-16 June 2022". If the match is not empty, you know you need to use the approach for this format. If it is empty, you use the other approach.
    3. You can also check the length of the string, but this might be risky with the varying lengths of the month names.

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

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • TelmoERF96 Profile Picture
    170 on at

    Thank you Agnius,

     

    I made it work with your second option. I used Parse Text on whatever type of date I had to check not exactly for what you said but instead for \d+[a-zA-z]-\d+ to look specifically for the second type of date I showed.

    And then used an IF to check if the variable created by the Parse Text action was empty to run the process I had created previously.

     

    Thank you once again for your help

     

    Telmo Ferreira

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 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard