• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Background Color using hex number with minimal CF, no VB?

hg13

New Member
Is there a way to change the background color of a cell by referencing a hex code in another cell? For instance, suppose cell Z1 has the value "FF0000". I'd like another cell, perhaps A3, to change its background color to "FF0000" based on that value in Z1. Then, when Z1 changes from "FF0000" to "0000FF", I'd like cell A3 to change from a red background to a blue background.

Is it possible to do this based on a formula in Conditional Formatting (or even using a formula without using CF, but definitely not using Visual Basic)?

I want to be able to dynamically change the value in Z1 (perhaps by using a calculation) and have it affect the background colors in other cells (A3 and others).

advTHANKSance!
 
Short answer. No you can't.

You will need VBA in one form or another.

You can convert HEX to RGB or HSL. Then set up Conditional Format based on HEX value and set Fill color to corresponding RGB/HSL.

However, be warned, you will need to set up CF for each HEX value, and depending on number of HEX code that you want to correspond to... It's going to need obscene number of CF and will severely impact workbook performance.

See attached sample for Black, White, Red only.
 

Attachments

  • CF_HEX.xlsb
    10.1 KB · Views: 2
Back
Top