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 / isnumeric if statement...
Power Apps
Answered

isnumeric if statement with number formatting help

(0) ShareShare
ReportReport
Posted on by 70

Hello,

 

I currently have a form datacardvalue which can be used as text or numeric when creating a new project entry. When displaying the data on the view form display I would like to format the data if it is numeric, if it's alphanumeric then leave it as is. I thought my current function would work but It keeps giving me an error (Invalid argument type, Expecting a number value. Location DataCardValue26.Value)

 

 

 

If(!IsNumeric(Parent.Default), Parent.Default, "$" & If(Parent.Default > 999, Text(Parent.Default, "[$-en-US]0,000.00"), Text(Parent.Default, "[$-en-US]0.00")))

 

 

 

 

If I change the false value to "no", the function works

 

 

 

If(!IsNumeric(Parent.Default), Parent.Default, "no")

 

 

 

 

when I use the numeric formatting on it's on for a number it works as well. Is there a reason why I can't nest the number formatting if statement in?

Categories:
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    HI @JP86 ,

    I am actually surprised #2 works as you are testing for two different types of data in the underlying data field and there is only one possibility (whatever the type of field is). What type of field is in Parent.Default? If it is Numeric, then the first test is redundant (it will always be numeric). If it is Text (but can be formatted as a number) then

    If(
     Value(Parent.Default)>0, 
     "$" & 
     If(
     Value(Parent.Default) > 999, 
     Text(
     Value(Parent.Default), 
     "[$-en-US]0,000.00"
     ), 
     Text(
     Value(Parent.Default), 
     "[$-en-US]0.00"
     )
     ),
     Parent.Default, 
    )

     

    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.

     

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @JP86 ,

     

    Please try this code

     

    If(!IsNumeric(Parent.Default), Parent.Default, Parent.Default > 999, Text(Parent.Default, "[$-en-US]0,000.00"), Text(Parent.Default, "[$-en-US]0.00"))

     

     

    Best Regards,

    Wearsky

    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • JP86 Profile Picture
    70 on at

    Hi @WarrenBelz , Thanks for the response. You are correct, I have CDS table column set as Text, this field should be able to accept text or numeric.  If it is a number, i want to format it using the numeric formatting.

     

    Neither of the suggestions worked @WarrenBelz and @v-xiaochen-msft . I'm kinda at a lost, the only two options for this field will be T&E or a dollar value ex: 1000.00. Shouldn't the isnumeric work in this case?

  • JP86 Profile Picture
    70 on at

    @WarrenBelz I would like to add that when i use this function, it works and provides the proper response true and false based on if the data is a number (1000.00) or text (T&E).

    If(IsNumeric(Parent.Default), "true", "false")

     

    I'm assuming the error occurs when trying to format the number within the if statement.

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

    HI @JP86 ,

    This is a guess as I have never tried what you are doing, but I will go back to my first comment - you are working with two different data types in the If statement and I think the authentication logic in Power Apps is struggling with that.

  • JP86 Profile Picture
    70 on at

    @WarrenBelz , interesting. Thanks for the support with this issue. Would you be able to assist with the text formatting. I can't figure out why this isn't working, I have followed the guide online and other forum posts but it doesn't format the number into currency. Am i missing something?

     

     

    Text(Parent.Default, "[$-en-US]$ #,###.00")

     

    This doesn't format the number. It just shows 1000. Does this have anything to do with the CDS table column format being Text?

  • JP86 Profile Picture
    70 on at
    Text(Value(Parent.Default), "[$-en-US]$ #,###.00")

     

    This worked. I am going to try with my original if statement to see if i can get it working.

  • Verified answer
    JP86 Profile Picture
    70 on at
    If(IsNumeric(Parent.Default), Text(Value(Parent.Default), "[$-en-US]$ #,###.00"), Parent.Default)

     

    This seems to be working for me and doing what I need it to do.  Thank you @WarrenBelz  and @v-xiaochen-msft  for pointing me in the right direction!

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

    Thanks @JP86 ,

    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. 

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
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard