Is it possible to define a custom number format via HEX or RGB, as in the following?
[Black][>5]0.0;[Red][<0]-0.0;[Color34]0.0
I'm looking for a dark orange color (#FF9900), and [Orange]
doesn't work.
I've tried the full spectrum of 56 colors, as suggested by this article, or the few built in by name but none are even close to the correct shade of orange.
The few Excel has built in don't include orange:
[BLACK][GREEN][RED][BLUE][CYAN][MAGENTA][WHITE][YELLOW]
Making comments to an answer:
The only ways I know to achieve different font colors depending on values are:
Specifying colors in number formats - for this Microsoft itself documents only the 8 named ones [Black]...[Red], even [ColorNN] is an undocumented hack.
Conditional formatting.
Using VBA.
To specifying colors in number formats one needs to know the guidelines for customizing a number format. There only the 8 named colors [Black], [Green], [White], [Blue], [Magenta], [Yellow], [Cyan], [Red] are documented. But using [ColorNN] with NN
being the color index is also possible for 56 indexed colors. To determine which colors are indexed with which index, one could using the following VBA
macro:
Sub UDColorNumberFormats()
With ActiveSheet
For i = 1 To 56
sNumberFormat = "[Color" & i & "]0"
.Cells(i, 1).Value = sNumberFormat
.Cells(i, 2).NumberFormat = sNumberFormat
.Cells(i, 2).Value = 888888
.Cells(i, 3).Interior.ColorIndex = i
Next
End With
End Sub
Running this macro in Excel for Windows (versions 2007 up to 2016 tested) will show, that the [Color45] for example is orange color. But if we take a look at the Microsoft documentation of ColorIndex Property, we must see, that even Microsoft shows different indexed colors. Maybe simply not updated since earlier versions?
As @Zephyr Mays had to realize, Excel for Mac also uses different indexed colors. So Excel for Mac and Excel for Windows are not 100% compatible in this point. But the macro should run in Excel for Mac also. So one could check whether the indexed colors, which Excel for Mac uses, are the ones which are shown in documentation for ColorIndex Property. If so, then Excel for Mac uses a default color palette from earlier versions than Excel for Windows uses. This could be called a bug in my opinion and could be reported to Microsoft as such.
As I noted in comments above, the color indices used in [COLORNN] are different in Libreoffice/Openoffice Calc also. There they are even different from the interior color indices. And they are dependent on the platform (64-bit or 32-bit) also. For me, Libreoffice in 64-bit Ubuntu has 64 color indices (1-64) available while Libreoffice in 32-bit Windows has only 32 color indices (1-32) available. But this behavior is not a bug since Libreoffice/Openoffice Calc is not 100% Excel compatible and does not want it to be.