Count and display duplicate values in a MsgBox from a single column in Excel VBA

Centeno, Erwin 1 Reputation point
2022-02-14T08:00:12.313+00:00

Hello guys! Sorry if you cant understand my title, English is not my first language.

I need a code to count all duplicate data from column A, then display those duplicate instances in a MsgBox with a total count per duplicated data? Thank you!!

It should look like this:

174055-picture1.png

Thank you!!

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,851 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Doug Robbins - MVP 716 Reputation points
    2022-02-20T09:07:36.79+00:00

    Assuming that the ID Numbers are in Column A,

    In B1 enter the formula

    =Unique(A:A)

    In C1 enter the formula

    =IF(COUNTIF(A:A,B1)>1,"ID# " & B1 & " = " & COUNTIF(A:A,B1) & " Instances","")

    and copy it down

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.