Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:06:52+00:00 2026-06-15T11:06:52+00:00

I need all duplicate for a particular value with same column color.This will help

  • 0

I need all duplicate for a particular value with same column color.This will help me in finding how many duplicates are there for a particular value,corresponding column values etc.
Please find Sample Excel. If I do Conditional formatting, highlight duplicates, this will give same color to all the duplicates irrespective of values.This wont solve the purpose.
Also suggest other way of differentiating in duplicate values in excel if any.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:06:54+00:00Added an answer on June 15, 2026 at 11:06 am

    There’s no way to do what you want with conditional formatting, but I reckon the following macro will do what you want. It builds a dictionary of unique values and assigns a random colour to each, which is then matched and reused for any duplicates.

    ' Base function that can be used for different columns.
    Sub colorDistinctInColumn(ByVal columnLetter As String)
        Dim lastRow As Integer
        Dim i As Integer
        Dim dict
        Dim currentCell As Range
        Dim columnNumber As Integer
    
        ' Create a dictionary to hold the value/colour pairs
        Set dict = CreateObject("Scripting.Dictionary")
    
        ' Find the last-used cell in the column of interest
        lastRow = ActiveSheet.Columns(columnLetter).Cells.Find( _
            "*", _
            SearchOrder:=xlByRows, _
            LookIn:=xlValues, _
            SearchDirection:=xlPrevious).Row
    
        ' Pick columnNumber using the given column letter
        columnNumber = ActiveSheet.Columns(columnLetter).Column
    
        ' Loop through all of the cells
        For i = 1 To lastRow
            Set currentCell = ActiveSheet.Cells(i, columnNumber)
    
            ' See if we've already come across the current value
            If Not dict.exists(currentCell.Value) Then
    
                ' This value has not been encountered yet,
                ' so store it and assign a random colour
                dict.Add currentCell.Value, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
            End If
    
            ' Set the colour of the current cell to whichever colour
            ' has been stored for the current cell's value
            currentCell.Interior.Color = dict(currentCell.Value)
        Next i
    
        Set dict = Nothing
    End Sub
    
    ' Actual Macro that will run in Excel
    Sub colorDistinctInColumnA()
        Call colorDistinctInColumn("A")
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Regular expression: match all words except I need your help for using
Possible Duplicate: Get all files from VSS for a given date? I need to
I need some help regarding RSS feeds. I need all the RSS feeds data
Possible Duplicate: Generating all Possible Combinations Is there a good LINQ way to do
I need to delete all duplicate rows except the first occurrence of similar rows
In the following db, I need all users and their locations, without duplicates, and
I need all records which have year entered from search criteria. for ex: String
i need all permutation from N lists, i dont know N until the program
I think the question is pretty simple, do I need all the rest of
i have a string which has the following format (3,1,Mayer,Jack). I need all 4

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.