+ Reply to Thread
Results 1 to 6 of 6

Conditional Formatting with random colors

  1. #1
    Registered User
    Join Date
    04-16-2019
    Location
    Sleaford
    MS-Off Ver
    O365
    Posts
    78

    Conditional Formatting with random colors

    Good evening,
    I've been recently playing around with 1 spreadsheet that I'm using at work.
    Basically what i need is to display duplicated values on one of our reports.

    What I'm trying to do is displaying all duplicated values on table where if value is duplicated either 1 row up or 1 row below then conditional formatting would color those cells with random color like i have displayed it on the picture below...

    Formula I'm using to get duplicated values is first by detecting if values is the same from list
    Please Login or Register  to view this content.
    Then in the next sheet using "Yes" Or "No" inputs displaying these duplicates on the list.
    Please Login or Register  to view this content.
    Now only thing that's need to be done is to color with random color where duplicates appear next to each other.. Don't know if this is possible without using VBA but waiting on your replies.
    Thanks
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional Formatting with random colors

    1. Not really sure what you are trying to do using INDIRECT, but see if this will simplify things...
    =IF(OR(C2=C1,C2=C3),1,0)

    2. When using formulas in CF, you need to specify the color, so I dont think you can get random colors that way. However, if you modify the "test" formula to return a progressively increasing number (1 for teh 1st match, 2 for the 2nd etc), you could probably base the CF on that sequence?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    04-16-2019
    Location
    Sleaford
    MS-Off Ver
    O365
    Posts
    78

    Re: Conditional Formatting with random colors

    Quote Originally Posted by FDibbins View Post
    1. Not really sure what you are trying to do using INDIRECT, but see if this will simplify things...
    =IF(OR(C2=C1,C2=C3),1,0)
    Thanks, that's just another way how to check top and bottom cell for match.
    I've came to a point where i could just add these duplicates to pivot table to display only first cell where is duplicate. For example if cell C3 or C4 or C5 is all the same ( duplicates ) then to mark with helper formula that C3 is "MARKED" and C4 and C5 will be unmarked. And then till next duplicates where again first duplicate will be "MARKED"

    Any ideas how to do this?

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,999

    Re: Conditional Formatting with random colors

    In response to the first post, this proposal produces a rotation of fill colors for consecutive duplicates.
    1. Column B is populated using: =IF(AND(C2=C3,C2<>C1),SUM(MAX(B$1:B1),1),IF(C2=C1,B1,0))
    2. Column C is highlighted using variations of the following as a conditional formatting rule: =AND(B2<>0,MOD(B2,4)=1)
    This rule produces four color highlighting, however it could be changed to produce any number of rules from 2 and up.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    04-16-2019
    Location
    Sleaford
    MS-Off Ver
    O365
    Posts
    78

    Re: Conditional Formatting with random colors

    Quote Originally Posted by JeteMc View Post
    In response to the first post, this proposal produces a rotation of fill colors for consecutive duplicates.
    1. Column B is populated using: =IF(AND(C2=C3,C2<>C1),SUM(MAX(B$1:B1),1),IF(C2=C1,B1,0))
    2. Column C is highlighted using variations of the following as a conditional formatting rule: =AND(B2<>0,MOD(B2,4)=1)
    This rule produces four color highlighting, however it could be changed to produce any number of rules from 2 and up.
    Let us know if you have any questions.
    Thanks JeteMc. Works perfect and will do the job.
    Only 1 question now. Can i somehow (with a helper formula) display only 1st cell number for each duplicate in let's say G Column.
    This would help me to display in pivot table only duplicate occasion where they appear. Not the whole list of them.

    See example.

    EDITED.

    Sorted this now. Thanks for help JeteMc.

    If anyone interested here is the formula.
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by Gochix2018; 09-07-2021 at 07:43 PM.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,999

    Re: Conditional Formatting with random colors

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Conditional Formatting more than 3 colors via vba
    By FastFish in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2015, 12:24 PM
  2. conditional Formatting with colors
    By slacknoise in forum Excel General
    Replies: 3
    Last Post: 11-20-2014, 01:09 PM
  3. Conditional formatting for colors
    By ammartino44 in forum Excel General
    Replies: 1
    Last Post: 02-28-2014, 08:02 PM
  4. [SOLVED] Conditional Formatting Colors
    By FoxRacing1234 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-25-2013, 10:07 AM
  5. Copying over conditional formatting colors
    By maks25 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2011, 10:32 AM
  6. Conditional Formatting Colors
    By dmyoungsal in forum Excel General
    Replies: 3
    Last Post: 07-15-2008, 05:38 PM
  7. conditional formatting (need 10 colors)
    By dmyoungsal in forum Excel General
    Replies: 7
    Last Post: 07-15-2008, 08:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1