Forum Discussion

PeterVelschow's avatar
PeterVelschow
Copper Contributor
Oct 31, 2020
Solved

Conditional number color format

#Office365 #Office2016 (If conditional formats)

 

Hi All. Is there a way that I can make a returned sum of numbers a specific color? I would like negative numbers to be red, positive numbers green and 0 black.

I have tried searching in here and I only get formatting cell color results 😞 

I am on a formula looking a bit like this:

 

=if(E34-(E17+E29)>"0",[apply hex code for green]),(E34-(E17+E29)<"0",[apply hex code for red]),(E34-(E17+E29)="0",[apply hex code for black]))

 

where

[apply hex code for "color"]

gives the NUMBER the color NOT the cell.

 

I might be down the wrong track so please, if anyone can help please do 🙂

 

Regards

Peter

8 Replies

  • PeterVelschow Riny_van_Eekelen Wyn Hopkins 

    Two good solutions but which is the better?

    1. Conditional formatting has a proper user interface supporting the definition of complex formatting rules.  On the other hand, there is a maintenance burden as drag-and-drop gradually scrambles the region to which the  formatting is applied (I wonder why CF does not support defined ranges properly?).

    2. Number formatting is an arcane skill conducted requiring obscure codes to be applied within a user-hostile development context.  That said, the functionality is an exact match for the OP's stated requirement.  Number formatting can also be introduced as part of an applied Style which, at least,, make its definition a one-off task (I wonder what proportion of users employ Styles routinely?).

     

    The only change I would make to Riny's solution is to use [Color10] rather than [Green] if it is to be viewed against a white background.

      • langben's avatar
        langben
        Copper Contributor
        How do you color cell. Red if negative. Blue if positive
    • PeterVelschow's avatar
      PeterVelschow
      Copper Contributor

      Hi Wyn Hopkins 

      Thanks a lot for the fast and clarifying response. I had searched for precisely that way to color my numbers, but simply oversaw it. Now things work as a charm 🙂

       

      Regards

      Peter

Resources