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 / Error message converti...
Power Apps
Suggested Answer

Error message converting text to value

(1) ShareShare
ReportReport
Posted on by 2
Can anyone provide any guidance to how to convert text to a number without getting an error message. This is the If statement I am using. I am comparing 2 numbers from 2 different text controls and attempting to change the fill color of a circle. Everything works properly but I still get an error when the app loads that says "the value 'text' cannot be converted to a number."
 
   If(
        Value(CountActual_4.Text) > Value(CountMinimum_4.Text),
        Color.Green,
        If(
            Value(CountActual_4.Text) = Value(CountMinimum_4.Text),
            Color.Gold,
            Color.Red
        )
    )
 
 
I have the same question (0)
  • scalca Profile Picture
    252 Moderator on at
    What's the initial value of the text fields ? 
    probably when it loads the app the initial value is some text which cannot be converted and after that you load get some values from a source. 
    you could implement an exception handling mechanism to catch the error using IfError()
  • WarrenBelz Profile Picture
    154,490 Most Valuable Professional on at
    Firstly try this ,but also paste it in all at once rather than typing
    With(
       {
          _Actual: Value(CountActual_4.Text),
          _Min: Value(CountMinimum_4.Text)
       },
       If(
          _Actual > _Min,
          Color.Green,
          _Actual = _Min,
          Color.Gold,
          Color.Red
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    154,490 Most Valuable Professional on at
     
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Suggested answer
    Inogic Profile Picture
    1,202 Moderator on at
    Hi,
     
    The error occurs because the Value function is being applied to the Text property of your controls, but when the app loads, the Text property may initially be blank or contain non-numeric values. This causes the Value function to throw an error since it cannot convert a blank or invalid text to a number.

    To resolve this issue, you can use the IsBlank or IsNumeric function to handle these cases gracefully. Here is the updated formula:

    If(
        IsNumeric(CountActual_4.Text) && IsNumeric(CountMinimum_4.Text),
        If(
            Value(CountActual_4.Text) > Value(CountMinimum_4.Text),
            Color.Green,
            If(
                Value(CountActual_4.Text) = Value(CountMinimum_4.Text),
                Color.Gold,
                Color.Red
            )
        ),
        Color.Gray // Default color if the input is not numeric
    )
     
    Hope this helps.
     
    Thanks!
    Inogic Professional Services: Power Platform/Dynamics 365 CRM
    An expert technical extension for your techno-functional business needs
    Drop an email at crm@inogic.com 
    Service: https://www.inogic.com/services/ 
    Tips and Tricks: https://www.inogic.com/blog/ 
  • WarrenBelz Profile Picture
    154,490 Most Valuable Professional on at
    @Inogic is correct - that one slipped my mind when I initially responded - I was too focussed on another possible cause.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard