How to use GREP to make negative figures in red, INCLUDING past the decimal point?

Community Beginner ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Hello one and all! Im currently using a GREP style to change all my negative figures automatically into it's red colored character style, however it will not include the numebers that appear after the deeecimal point. Does anyone have a solution for this please?

 

JacquieWest_0-1661756351263.png

Im currently using -\$\d+

 

Cheers!

TOPICS
How to

Views

56

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Aug 29, 2022 Aug 29, 2022

Try this expression: 

-\d+(\.|)\d+

Screenshot 2022-08-29 at 12.42.40 AM.png 

Likes

Translate

Translate
Community Expert , Aug 29, 2022 Aug 29, 2022

I would use -\$?\d+\.?\d*

It should find negative numbers with or without the $ and well as with or without  a decimal.

Likes

Translate

Translate
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Try this expression: 

-\d+(\.|)\d+

Screenshot 2022-08-29 at 12.42.40 AM.png 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

I would use -\$?\d+\.?\d*

It should find negative numbers with or without the $ and well as with or without  a decimal.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 30, 2022 Aug 30, 2022

Copy link to clipboard

Copied

Oh my gosh, so close! Thanks for that. The only thing I need it to include now is the letter after the number, such as the 'M' to represent the Million. Please see here:

 

JacquieWest_0-1661909234155.png

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 30, 2022 Aug 30, 2022

Copy link to clipboard

Copied

Oh hang on! It worked, I just cleared the other overrides, your a legend Peter!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2022 Aug 31, 2022

Copy link to clipboard

Copied

LATEST

My expression shouldn't find a trailing letter, but that would be easy enough to add.

Stick a \u? on the end to get -\$?\d+\.?\d*\u? and it will add one uppercase letter if any exists.

This could be further modified to select only certain characters, say M, K, C, B, or T if you like, or to include upper and lowercase.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines