Apply conditional formatting to large number of text cells












0















I have a table that contains up to about 100 different text values and I want to color them according to the text so that you can visually see what cells have the same text (table!B2:DB100).



I have a separate sheet that lists the values that are in the table (dynamically) (list!A1:A100).



A possible solution would be to apply a conditional formatting that figures out whether a cell in table!B2:DB100 is equal to list!A1. If so color it with color 1. Then add another conditional formatting saying if a cell in table!B2:DB100 is equal to list!A2 then color is with color 2. And so on.



Doing this manually would be painful because there are 100 possible text values.



I believe I could do it with a macro which has the added advantage that you can apply RGB values in a nice orderly way.




Is a macro, in fact, the best way to do it? Will it bog down the spreadsheet to have ~100 conditional formattings applied? Is there a simpler way to achieve the same effect?











share|improve this question





























    0















    I have a table that contains up to about 100 different text values and I want to color them according to the text so that you can visually see what cells have the same text (table!B2:DB100).



    I have a separate sheet that lists the values that are in the table (dynamically) (list!A1:A100).



    A possible solution would be to apply a conditional formatting that figures out whether a cell in table!B2:DB100 is equal to list!A1. If so color it with color 1. Then add another conditional formatting saying if a cell in table!B2:DB100 is equal to list!A2 then color is with color 2. And so on.



    Doing this manually would be painful because there are 100 possible text values.



    I believe I could do it with a macro which has the added advantage that you can apply RGB values in a nice orderly way.




    Is a macro, in fact, the best way to do it? Will it bog down the spreadsheet to have ~100 conditional formattings applied? Is there a simpler way to achieve the same effect?











    share|improve this question



























      0












      0








      0








      I have a table that contains up to about 100 different text values and I want to color them according to the text so that you can visually see what cells have the same text (table!B2:DB100).



      I have a separate sheet that lists the values that are in the table (dynamically) (list!A1:A100).



      A possible solution would be to apply a conditional formatting that figures out whether a cell in table!B2:DB100 is equal to list!A1. If so color it with color 1. Then add another conditional formatting saying if a cell in table!B2:DB100 is equal to list!A2 then color is with color 2. And so on.



      Doing this manually would be painful because there are 100 possible text values.



      I believe I could do it with a macro which has the added advantage that you can apply RGB values in a nice orderly way.




      Is a macro, in fact, the best way to do it? Will it bog down the spreadsheet to have ~100 conditional formattings applied? Is there a simpler way to achieve the same effect?











      share|improve this question
















      I have a table that contains up to about 100 different text values and I want to color them according to the text so that you can visually see what cells have the same text (table!B2:DB100).



      I have a separate sheet that lists the values that are in the table (dynamically) (list!A1:A100).



      A possible solution would be to apply a conditional formatting that figures out whether a cell in table!B2:DB100 is equal to list!A1. If so color it with color 1. Then add another conditional formatting saying if a cell in table!B2:DB100 is equal to list!A2 then color is with color 2. And so on.



      Doing this manually would be painful because there are 100 possible text values.



      I believe I could do it with a macro which has the added advantage that you can apply RGB values in a nice orderly way.




      Is a macro, in fact, the best way to do it? Will it bog down the spreadsheet to have ~100 conditional formattings applied? Is there a simpler way to achieve the same effect?








      microsoft-excel vba conditional-formatting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 24 at 6:31









      p._phidot_

      666412




      666412










      asked Jan 24 at 5:31









      Dr XorileDr Xorile

      1115




      1115






















          1 Answer
          1






          active

          oldest

          votes


















          1














          For what it's worth, I have something working reasonably well. I wrote a macro to apply the conditional formatting.



          Sub conditional()
          '
          ' conditional Macro

          i = 1
          station = 1
          colorscheme = 1
          Do Until Sheets("Data").Cells(i + 3, 3) = ""
          a = "=Data!" + Sheets("Data").Cells(i + 3, 3).Address
          c1 = 255
          c2 = 147 + 17 * station
          Select Case colorscheme
          Case 1 'red
          mycolor = RGB(c1, c2, c2)
          Case 2 'yellow
          mycolor = RGB(c1, c1, c2)
          Case 3 'green
          mycolor = RGB(c2, c1, c2)
          Case 4 'cyan
          mycolor = RGB(c2, c1, c1)
          Case 5 'blue
          mycolor = RGB(c2, c2, c1)
          Case 6 'purple
          mycolor = RGB(c1, c2, c1)
          End Select
          Range("H4:BE48").FormatConditions.Add Type:=xlTextString, String:=a, _
          TextOperator:=xlContains
          With Range("H4:BE48").FormatConditions(Range("H4:BE48").FormatConditions.Count)
          .Interior.Color = mycolor
          .StopIfTrue = True
          End With
          i = i + 1
          station = station + 1
          If station = 5 Then
          station = 1
          colorscheme = colorscheme + 1
          End If
          If colorscheme = 7 Then
          colorscheme = 1
          End If
          Loop

          End Sub


          And here's how it looks in an example:



          Conditional Formatting



          I'd welcome any comments, suggestions, or improvements.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397763%2fapply-conditional-formatting-to-large-number-of-text-cells%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            For what it's worth, I have something working reasonably well. I wrote a macro to apply the conditional formatting.



            Sub conditional()
            '
            ' conditional Macro

            i = 1
            station = 1
            colorscheme = 1
            Do Until Sheets("Data").Cells(i + 3, 3) = ""
            a = "=Data!" + Sheets("Data").Cells(i + 3, 3).Address
            c1 = 255
            c2 = 147 + 17 * station
            Select Case colorscheme
            Case 1 'red
            mycolor = RGB(c1, c2, c2)
            Case 2 'yellow
            mycolor = RGB(c1, c1, c2)
            Case 3 'green
            mycolor = RGB(c2, c1, c2)
            Case 4 'cyan
            mycolor = RGB(c2, c1, c1)
            Case 5 'blue
            mycolor = RGB(c2, c2, c1)
            Case 6 'purple
            mycolor = RGB(c1, c2, c1)
            End Select
            Range("H4:BE48").FormatConditions.Add Type:=xlTextString, String:=a, _
            TextOperator:=xlContains
            With Range("H4:BE48").FormatConditions(Range("H4:BE48").FormatConditions.Count)
            .Interior.Color = mycolor
            .StopIfTrue = True
            End With
            i = i + 1
            station = station + 1
            If station = 5 Then
            station = 1
            colorscheme = colorscheme + 1
            End If
            If colorscheme = 7 Then
            colorscheme = 1
            End If
            Loop

            End Sub


            And here's how it looks in an example:



            Conditional Formatting



            I'd welcome any comments, suggestions, or improvements.






            share|improve this answer






























              1














              For what it's worth, I have something working reasonably well. I wrote a macro to apply the conditional formatting.



              Sub conditional()
              '
              ' conditional Macro

              i = 1
              station = 1
              colorscheme = 1
              Do Until Sheets("Data").Cells(i + 3, 3) = ""
              a = "=Data!" + Sheets("Data").Cells(i + 3, 3).Address
              c1 = 255
              c2 = 147 + 17 * station
              Select Case colorscheme
              Case 1 'red
              mycolor = RGB(c1, c2, c2)
              Case 2 'yellow
              mycolor = RGB(c1, c1, c2)
              Case 3 'green
              mycolor = RGB(c2, c1, c2)
              Case 4 'cyan
              mycolor = RGB(c2, c1, c1)
              Case 5 'blue
              mycolor = RGB(c2, c2, c1)
              Case 6 'purple
              mycolor = RGB(c1, c2, c1)
              End Select
              Range("H4:BE48").FormatConditions.Add Type:=xlTextString, String:=a, _
              TextOperator:=xlContains
              With Range("H4:BE48").FormatConditions(Range("H4:BE48").FormatConditions.Count)
              .Interior.Color = mycolor
              .StopIfTrue = True
              End With
              i = i + 1
              station = station + 1
              If station = 5 Then
              station = 1
              colorscheme = colorscheme + 1
              End If
              If colorscheme = 7 Then
              colorscheme = 1
              End If
              Loop

              End Sub


              And here's how it looks in an example:



              Conditional Formatting



              I'd welcome any comments, suggestions, or improvements.






              share|improve this answer




























                1












                1








                1







                For what it's worth, I have something working reasonably well. I wrote a macro to apply the conditional formatting.



                Sub conditional()
                '
                ' conditional Macro

                i = 1
                station = 1
                colorscheme = 1
                Do Until Sheets("Data").Cells(i + 3, 3) = ""
                a = "=Data!" + Sheets("Data").Cells(i + 3, 3).Address
                c1 = 255
                c2 = 147 + 17 * station
                Select Case colorscheme
                Case 1 'red
                mycolor = RGB(c1, c2, c2)
                Case 2 'yellow
                mycolor = RGB(c1, c1, c2)
                Case 3 'green
                mycolor = RGB(c2, c1, c2)
                Case 4 'cyan
                mycolor = RGB(c2, c1, c1)
                Case 5 'blue
                mycolor = RGB(c2, c2, c1)
                Case 6 'purple
                mycolor = RGB(c1, c2, c1)
                End Select
                Range("H4:BE48").FormatConditions.Add Type:=xlTextString, String:=a, _
                TextOperator:=xlContains
                With Range("H4:BE48").FormatConditions(Range("H4:BE48").FormatConditions.Count)
                .Interior.Color = mycolor
                .StopIfTrue = True
                End With
                i = i + 1
                station = station + 1
                If station = 5 Then
                station = 1
                colorscheme = colorscheme + 1
                End If
                If colorscheme = 7 Then
                colorscheme = 1
                End If
                Loop

                End Sub


                And here's how it looks in an example:



                Conditional Formatting



                I'd welcome any comments, suggestions, or improvements.






                share|improve this answer















                For what it's worth, I have something working reasonably well. I wrote a macro to apply the conditional formatting.



                Sub conditional()
                '
                ' conditional Macro

                i = 1
                station = 1
                colorscheme = 1
                Do Until Sheets("Data").Cells(i + 3, 3) = ""
                a = "=Data!" + Sheets("Data").Cells(i + 3, 3).Address
                c1 = 255
                c2 = 147 + 17 * station
                Select Case colorscheme
                Case 1 'red
                mycolor = RGB(c1, c2, c2)
                Case 2 'yellow
                mycolor = RGB(c1, c1, c2)
                Case 3 'green
                mycolor = RGB(c2, c1, c2)
                Case 4 'cyan
                mycolor = RGB(c2, c1, c1)
                Case 5 'blue
                mycolor = RGB(c2, c2, c1)
                Case 6 'purple
                mycolor = RGB(c1, c2, c1)
                End Select
                Range("H4:BE48").FormatConditions.Add Type:=xlTextString, String:=a, _
                TextOperator:=xlContains
                With Range("H4:BE48").FormatConditions(Range("H4:BE48").FormatConditions.Count)
                .Interior.Color = mycolor
                .StopIfTrue = True
                End With
                i = i + 1
                station = station + 1
                If station = 5 Then
                station = 1
                colorscheme = colorscheme + 1
                End If
                If colorscheme = 7 Then
                colorscheme = 1
                End If
                Loop

                End Sub


                And here's how it looks in an example:



                Conditional Formatting



                I'd welcome any comments, suggestions, or improvements.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 24 at 16:03

























                answered Jan 24 at 6:35









                Dr XorileDr Xorile

                1115




                1115






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397763%2fapply-conditional-formatting-to-large-number-of-text-cells%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕