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 / HOW many lines of code...
Power Apps
Answered

HOW many lines of code can be run of the if function?

(0) ShareShare
ReportReport
Posted on by 166

Just curious how many lines code is the max of the if function.when I input lots of code  under If function,then the forms can't be run successfully,when I reduce the line of the code ,then the form can be run successfully.and is there any solution to fix this issue?

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,909 Super User 2026 Season 2 on at

    There is no mandatory or known limit on the number of nested If functions in an app within PowerApps.

    However, the amount of the nested If function within an app would affect the app's performance. Use Switch() function instead of If function when you need to evaluate a single condition against multiple possible matches. Switch function can simplify your code and improve readability.

     

    If you have any questions or feedback, please let me know. Have a great day! 😊
    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Ricky24 ,

     

    If you can share the codes, we may be able to help you sort the problem more easily.

     

    Best regards,

  • Ricky24 Profile Picture
    166 on at

    Ricky24_0-1698827061113.png

    maybe my description isn't clear, only if function, but I have lots of nested under the if function like the picture shows maybe 500 lines, switch function can't achieve my request.

     

  • Ricky24 Profile Picture
    166 on at

    Hi thanks for your feedback,you can check the pic that i posted just now.

  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @Ricky24 ,

    One solution here is to make a reference list with all the possibilities and do a simple lookup - much easier to maintain as well 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Ricky24 Profile Picture
    166 on at

    appreciate  your feedback

    is there any video or other resource to show how to make a reference list and do a simple lookup function.

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Ricky24 ,

     

    Could you create a collection OnStart of the App, where maintains DataCardValue42 options, DataCardValue43 options and corresponding Values, then you will be able to get the value using LookUp function to reference a specific value from the collection based on values in the two dropdowns. 

     

    Best regards,

  • Verified answer
    WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @Ricky24 ,

    Make a new list in your data source containing all the combinations that you have hard-coded.
    You then can do a LookUp function on your two data drop-downs and reference the third field. I assume you have done a LookUp in Power Apps ?

  • Ricky24 Profile Picture
    166 on at

    thanks for your suggestion.actually, I don't use a lookup value, only use the If  function like below pic show,

    I will try to use a lookup function to run it.

    Ricky24_0-1698888188504.png

     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard