Forum Discussion
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
The simplest and most flexible approach is to use Conditional Formatting
Just apply 3 rules
8 Replies
- PeterBartholomew1Silver Contributor
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.
- PeterBartholomew1Silver Contributor
(Tried to edit this in to the previous post but wasn't allowed)
- langbenCopper ContributorHow do you color cell. Red if negative. Blue if positive
The simplest and most flexible approach is to use Conditional Formatting
Just apply 3 rules
- PeterVelschowCopper 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
- Riny_van_EekelenPlatinum Contributor
PeterVelschow Look into applying custom number formats to achieve this. An example is given in the picture below.
More about customising number formats here: