Forum Discussion

Steve Weaver's avatar
Steve Weaver
Copper Contributor
Apr 14, 2022

Formatting a text function

When evaluating the following formula, I would like the result to print is black if positive and red if negative: ="CY - "&TEXT(SUM(W3:W30),"$#,##0_);[Red]($#,##0)")"

 

Any help will be very much appreciated.

1 Reply

  • Steve Weaver 

    You cannot specify the color in the formula, it will be ignored. So use

    ="CY - "&TEXT(SUM(W3:W30),"$#,##0_);($#,##0)")

     

    Also, you cannot color part of the result of a formula. If you wish, you can color the entire result using conditional formatting:

     

    Select the cell with the formula.

    On the Home tab of the ribbon, select Conditional Formatting > New Rule...

    Select 'Use a formula to determine which cells to format'.

    Enter the formula

     

    =SUM(W3:W30)<0

     

    Click Format...

    Activate the Font tab.

    Select red as font color.

    Click OK, then click OK again.

Resources