cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

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

3 REPLIES 3
Highlighted
Dual Super User III
Dual Super User III

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!

Highlighted
Community Support
Community Support

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

Highlighted
Frequent Visitor

Re: display a negative number in parentheses

Thank You!

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,000)