How to color a cell based directly on a cell value

Copper Contributor
On mobile bc my internet isn't working today

How do I color a cell based not on its statistical relationship with other cells, but directly on its value? In particular I have a series of RGB values separated by channel and I'd like to include a sample of the color in question by the table.
4 Replies

Hello @rekkandevar ,

 

You can use conditional formatting to set the color of a cell based on a value. 

 

If, however, you want to use the current value of the cell to set the fill color to the equivalent RGB , then that is not possible with conditional formatting or with any worksheet technique. That would require VBA.

 

Can you post an example of the values your cells would have? RGB typically consists of three numeric values, not just one number, so I'd need to know how you store the RGB values in the cells.

 

It's three columns, one per channel. I also created a custom format, (##0);_(##0);_(##0) , which hopefully would work as well.

@rekkandevar As I said, there are no workbook functions or out of the box ways to use numbers in cells to fill a cell with RGB colors. This would require VBA. Are you open to that?

@rekkandevar  Attached is a file with a ChangeEvent macro working on Sheet 1. When you enter numbers into columns A, B and C, the cell in column D of the same row will be filled with the respective RGB value. You can copy and paste multiple values at the same time. Empty cells are treated as zero.  If the number combination results in invalid RGB, the cell fill will be removed and a warning displayed in the cell.

 

Is that something you can work with?