Select cells B1 to B3. This way, B1 is the offset starting point. So, in conditional formatting formulas, A1
will indicate the cell to the left of the current cell, not necessarily the first row.
Now, under Format -> Conditional Formatting -> Manage, enter Formula is A1=0
and Apply Style "Good" (that is, green).
Then add A1=1
for "Neutral" (yellow) and A1=2
for "Bad" (red). Finally, hit OK.
![conditional formatting for B1:B3](https://cdn.statically.io/img/i.sstatic.net/JQneZ.png)
EDIT:
Color scales currently require All Cells
, and cannot be used with Formula is
. So that leaves the following less-than-ideal solutions.
- Write a macro to read the values and set the cell colors. Re-run it whenever the values change, by a sheet event handler.
- Create for example 10 different styles of slightly different color. Then use STYLE and VLOOKUP to choose which of these styles should be used in each row.
- Create those 10 different styles but use conditional formatting with
Formula is
to choose which style.
Methods 1 and 2 are explained in detail along with examples at https://forum.openoffice.org/en/forum/viewtopic.php?t=55410.
One good approach might be to use method 2 above but write a macro to create 100 different styles. Then the macro only needs to be run once to set up, and from then on, formulas can take care of the coloring.