cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
JohnnyDataGuy
Level: Powered On

display a negative number in parentheses

How do you display a negative number in a textbox or label with parentheses instead of the minus sign?

For example my value is -5. 

I want to show it as (5).

How do I format that in a label or textbox?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: display a negative number in parentheses

Hi @JohnnyDataGuy ,

Do you want to display a negative number within a Text Input Box or Label using parentheses rather than minus sign?

 

I have made a test on my side, please consider take a try with the following workaround:

7.JPG

 Set the Default property of the Text Input Box2 to following:

If(
    IsMatch(TextInput1.Text, "\-\d+(\.\d+)?"),
    "(" & Substitute(TextInput1.Text, "-", "") & ")",
    TextInput1.Text
)

On your side, you may need to type the following:

If(
    IsMatch(Text(YourNegativeNumberValue), "\-\d+(\.\d+)?"),
    "(" & Substitute(Text(YourNegativeNumberValue), "-", "") & ")",
    TextInput1.Text
)

Please consider take a try with above solution, check if the issue is solved.

 

More details about the IsMatch function in PowerApps, please check the following article:

IsMatch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: display a negative number in parentheses

Hi @JohnnyDataGuy 

 

Can you try to update the expression as:

"("&Match("-5", "-(?<numvalue>\d+)?").numvalue&")"

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support Team
Community Support Team

Re: display a negative number in parentheses

Hi @JohnnyDataGuy ,

Do you want to display a negative number within a Text Input Box or Label using parentheses rather than minus sign?

 

I have made a test on my side, please consider take a try with the following workaround:

7.JPG

 Set the Default property of the Text Input Box2 to following:

If(
    IsMatch(TextInput1.Text, "\-\d+(\.\d+)?"),
    "(" & Substitute(TextInput1.Text, "-", "") & ")",
    TextInput1.Text
)

On your side, you may need to type the following:

If(
    IsMatch(Text(YourNegativeNumberValue), "\-\d+(\.\d+)?"),
    "(" & Substitute(Text(YourNegativeNumberValue), "-", "") & ")",
    TextInput1.Text
)

Please consider take a try with above solution, check if the issue is solved.

 

More details about the IsMatch function in PowerApps, please check the following article:

IsMatch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,351)