Forum Discussion

vividwhp's avatar
vividwhp
Copper Contributor
Jun 04, 2019
Solved

How to automatically change cell's background color by a formula

Hello,

I need some little help here, I'd like to write a formula to automatically change a cell's background color when the next cell's content (text or value) is different from the previous cell's content, for example please see the attached picture, 

As long as the next cell's content is different from the previous cell's content, the next cell's background color will be changed automatically. Does anyone know how to write a formula for this function?? I prefer writing formula instead of creating a rule because by this I can copy and paste this formula to apply to tons of other cells. Thank you sooooo much.

  • vividwhp , select your range without first column in it, create new conditional formatting rule as

    in formula it shall be relative references starting from top left cell of the range (N5). Apply desired format, Ok, here confirm or change selection

    That's all. You have only one rule to color your entire range, result is

     

5 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    vividwhp , formulas don't return cell properties as color, only values. That with VBA programming.

     

    At the same time the rule with simple formula could be applied to all your tons of cells. If they are in one range that will be only one rule for entire range, otherwise approximately as many as many ranges you have. 

    • vividwhp's avatar
      vividwhp
      Copper Contributor

      SergeiBaklan , thank you so much for the reply, i see..........

      so.......could you please quickly show me how to create the rule for this function for a entire range??

      please take the below example, I attached the file as well.

      thank you very very much.

       

      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        vividwhp , select your range without first column in it, create new conditional formatting rule as

        in formula it shall be relative references starting from top left cell of the range (N5). Apply desired format, Ok, here confirm or change selection

        That's all. You have only one rule to color your entire range, result is

         

Resources