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 / finding a number withi...
Power Automate
Unanswered

finding a number within a string of value

(0) ShareShare
ReportReport
Posted on by 8

Hi 

I have a loop starting from 1 to 100000 as below. Whenever the number "5" appears in any digits in the Loop Index, the loop index should value increase by 1. But the codes below don't seem to work. Any help will be appreciated. 

LOOP LoopIndex FROM 1 TO 100000 STEP 1
Text.FromNumber Number: LoopIndex DecimalPlaces: 0 UseThousandsSeparator: False FormattedNumber=> LoopIndex_Text
IF Contains(LoopIndex_Text, 4, True) THEN
Variables.IncreaseVariable Value: LastIndex IncrementValue: 1
END

I have the same question (0)
  • kinuasa Profile Picture
    801 Most Valuable Professional on at
    IF Contains(LoopIndex_Text, 4, True) THEN

    If it isn't 4 then wouldn't it be 5?

     

     

  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    Hi @winfs 

     

    Please try the below code

     

    LOOP LoopIndex FROM 1 TO 100000 STEP 1
    Text.FromNumber Number: LoopIndex DecimalPlaces: 0 UseThousandsSeparator: False FormattedNumber=> LoopIndex_Text
    IF (contains(LoopIndex_Text, 4, True)) = 4 THEN
    Variables.IncreaseVariable Value: LastIndex IncrementValue: 1
    END
    END

     

    and the change you need to write the if condition as shown in below image 

    UshaJyothi20_0-1707475124233.png

    in If activity first operand  

    %Contains(Yourvariable,Textyou need to check, True)%

     

    Hope this helps,

    Usha.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 284 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 188 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 144 Super User 2026 Season 2

Last 30 days Overall leaderboard