Oct 30 2020 06:35 PM
#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
Oct 30 2020 10:22 PM
@PeterVelschow Look into applying custom number formats to achieve this. An example is given in the picture below.
More about customising number formats here:
Oct 31 2020 12:37 AM
Solution
The simplest and most flexible approach is to use Conditional Formatting
Just apply 3 rules
Oct 31 2020 03:05 AM
@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.
Oct 31 2020 03:10 AM
(Tried to edit this in to the previous post but wasn't allowed)
Oct 31 2020 04:29 AM
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
Jun 26 2021 01:57 PM
Jun 26 2021 02:20 PM
That's in @Riny_van_Eekelen post in this thread above
Jul 03 2021 02:08 PM
Oct 31 2020 12:37 AM
Solution
The simplest and most flexible approach is to use Conditional Formatting
Just apply 3 rules