## Extract a list of duplicates from a column

The array formula in cell C2 extracts duplicate values from column A. Only one duplicate of each value is displayed in column C.

**Update 2017-08-19! New regular formula in cell C2:**

#### This video explains how to use the formula and how it works

If you want a list sorted from A to Z, read this article:

**Extract a list of alphabetically sorted duplicates from a column**

Comments(1) Filed in category: Duplicate values, Excel, Sort values

This post explains how to extract duplicate values using a condition:

**Create a list of duplicates where adjacent cell value meets a condition**

Comments(0) Filed in category: Duplicate values, Excel

You can also use more than one condition, this article shows you how:

**Filter duplicate values using critera**

Comments(0) Filed in category: Duplicate values, Excel

Filter a unique distinct list:

**5 easy ways to extract unique distinct values**

Comments(149) Filed in category: Advanced filter, Excel, Unique distinct values, Unique values

**Array formula in C2:**

#### How to enter an array formula

- Copy (Ctrl + c) above formula
- Double click on cell C2
- Paste (Ctrl + v) to cell C2
- Press and hold CTRL + SHIFT simulatneously
- Press Enter once
- Release all keys

Your formula now looks like this: {=array_formula}

Don't enter the curly brackets, they appear automatically.

**Learn the basics of Excel arrays**

Comments(2) Filed in category: Count values, Excel

#### How to copy formula

Copy cell C2 and paste it to cells below as far as needed.

#### Remove #num errors:

Copy cell C2 and paste it down to D20.

Learn more:

Comments(0) Filed in category: Excel

#### Earlier Excel versions, array formula in C2:

### How this array formula works

**Step 1 - Show a duplicate value only once**

=INDEX($A$2:$A$20, MATCH(0, **COUNTIF(C1:$C$1, $A$2:$A$20)**+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1), 0))

COUNTIF(C1:$C$1, $A$2:$A$20) contains both a relative and absolute reference (C1:$C$1) to a range.

When you copy a cell reference like this the cell reference expands.

COUNTIF(C1:$C$1, $A$2:$A$20) returns this array in cell C2: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

Comments(5) Filed in category: Excel

**Step 2 - Filter values in $A$2:$A$20 having duplicates**

=INDEX($A$2:$A$20, MATCH(0, COUNTIF(C1:$C$1, $A$2:$A$20)+**IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1)**, 0))

COUNTIF($A$2:$A$20, $A$2:$A$20) counts the number of cells within a range that meet the given condition. The returning array is (2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1).

COUNTIF($A$2:$A$20, $A$2:$A$20)>1 returns this array: (TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE).

IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1) returns (1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0).

Comments(9) Filed in category: Excel

**Step 3 - Calculate arrays combined**

=INDEX($A$2:$A$20, MATCH(0, **COUNTIF(C1:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1)**, 0))

COUNTIF(C1:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1)

(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + (1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0) equals

(1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0)

**Step 4 - Identify duplicates**

=INDEX($A$2:$A$20, **MATCH(0, COUNTIF(C1:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1), 0)**)

MATCH(0, COUNTIF(C1:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1), 0) becomes

MATCH(0, (1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0), 0) is 2.

Match returns the relative position of an item in an array that matches a specified value

Comments(12) Filed in category: Excel

**Step 5 - Return duplicates**

=INDEX($A$2:$A$20, MATCH(0, COUNTIF(C1:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1), 0))

becomes

=INDEX($A$2:$A$20, 2) is Federer, Roger.

Index returns a value or reference of the cell at the intersection of a particular row and column, in a given range

Comments(14) Filed in category: Cross reference table, Excel, INDEX function

**Final thoughts**

When formula in c2 is copied to c3 the refence changes.

*Example*

The formula in c2: =INDEX($A$2:$A$20, MATCH(0, COUNTIF(C1:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1), 0))

Then copy the formula to C3.

The formula references changes: =INDEX($A$2:$A$20, MATCH(0, COUNTIF(C**2**:$C$1, $A$2:$A$20)+IF(COUNTIF($A$2:$A$20, $A$2:$A$20)>1, 0, 1), 0))

Read more about absolute and relative cell references.

This makes it possible to avoid previous cell values (C2) and only calculate remaining values.

#### Download excel sample file for this tutorial.

how-to-extract-a-list of duplicates from a columns-in-excelv2.xlsx

(Excel 2007 Workbook *.xlsx)

### Category: Duplicate values

Extract a list of duplicates from three columns combined using array formula in excel

Question: I have three ranges or lists and I need to extract duplicates from those ranges combined using excel array […]Comments(7) Filed in category: Duplicate values, Excel

How to extract a list of duplicates from a column in excel

Edit: A better shorter easier array formula in this post. Here is a solution (Column C) to extract duplicates from […]Comments(4) Filed in category: Duplicate values, Excel

Filter unique distinct and duplicate values from a large data set in excel 2007

In this post I am going to describe how to filter duplicate and unique distinct values from a really large […]Comments(4) Filed in category: Case sensitive, Duplicate values, Excel, Unique distinct values

Find min and max unique and duplicate numerical values

Question: How do I get the largest and smallest unique and duplicate value? The image below shows you a list […]Comments(4) Filed in category: Duplicate values, Excel, Unique values

Extract duplicate values with exceptions

The formula in cell E2 returns duplicate values from column A but values in column C are excluded from the […]Comments(3) Filed in category: Duplicate values, Excel

Extract duplicates and their adjacent values

Question: How do i only put duplicate cell values from a list into another new list and their adjacent values? […]Comments(3) Filed in category: Duplicate values, Excel

Remove duplicates on same date in excel

Question: Column A1 Has dates Column B as data A1 : 1/1/2010 : 5000 A2 : 2/1/2010 : 4000 A3 […]Comments(3) Filed in category: Dates, Duplicate values, Excel, Unique distinct values

Excel udf: Remove duplicates from a large dataset

Aamer asks: I have a sheet with 3000 rows of invoice dates that are out of order. There could be […]Comments(3) Filed in category: Duplicate values, Excel, Unique distinct values

Filter duplicates within same date, week or month in excel

Filter duplicates on same date Array formula in F3: =INDEX($C$3:$C$11, SMALL(IF(MATCH($C$3:$C$11&$D$3:$D$11, $C$3:$C$11&$D$3:$D$11, 0)<>ROW($C$3:$C$11)-MIN(ROW($C$3:$C$11))+1, ROW($C$3:$C$11)-MIN(ROW($C$3:$C$11))+1, ""), ROW(A1))) + CTRL + SHIFT […]Comments(2) Filed in category: Dates, Duplicate values, Excel

### 41 Responses to “Extract a list of duplicates from a column”

### Leave a Reply

**How to add a formula to your comment:**

<code>your formula</code>

**How to add VBA code to your comment:**

[vb 1="vbnet" language=","]

VBA code

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org

Add picture link to comment.

**Contact Oscar**

You can contact me through this webpage

No mention of Nadal :D I'm guessing you're a Federer fan Thumbs UP

I tried this formula, it does not work for me - any way to figure out what I am doing wrong??

Sheila McGarrigle,

How to create an array formula

Select cell C2

Copy/paste array formula

Press and hold Ctrl + Shift

Press Enter

how to extract the unique distinct column from one sheet to another sheet in the same work book using formula.

audithya,

Extract a unique distinct list

Change cell references.

i changed the cell reference but the value is showing as " 0".

what i want is

sheet 1 - column A has 123412323422 values (Having blank cells).

i want this unique distinct values to sheet2 column A..

please provide the formula to get the values into sheet 2 from sheet 1.

thanqq

Audithya

added to the above one

i want the result in sheet 2 column A as 1234(without blank cells)

Here is an example workbook:

audithya.xlsx

Oscar,

I used this example workbook in my own application and it works great. I'm wondering if there is a way to filter the results and/or criteria. In the duplicates column I have a wide range of text-filled cells, which duplicate quite frequently. I would like to have this formula return only cells that begin with the letter "L", and also eliminate all duplicates. Is this possible?

Example

Column A, Sheet 1

APPLE

BAKER

LOT1

LOT3

FARM1

FARM1

TABLE

LOT1

LOT4

LOT3

Returning data to Column A, Sheet2

LOT1

LOT3

LOT4

(Not necessarily in a sorted order)

MikeB

Read this:

Filter unique distinct values beginning with a letter

thanqq oscar... :)

Hi Oscar..

I have two Sheets in a workbook. one column of the first sheet contains first sheet contains duplicate data. in the second sheet the column have the data which is extracted the unique data from the first sheet. what i want is the comparing these two columns data if they are equal then the next column result in sheet 1 will be come on the sheet 2

Ex.

Sheet 1:

ColA ColB

a Pass

a Fail

ab Pass

abc Pass

abcd Pass

abcde Fail

abc Fail

Sheet2: wants to be look like

ColA ColB

a Pass

ab pass

abc pass

abcd pass

abcde fail

this colB of sheet 2 extracts the data from colB of sheet 1 if sheet2!ColA=Sheet1!ColA.

Please provide the formula. I am poor in VBA

saiaudithya

Formula in cell B1, sheet 2:

Index(Sheet1!$B$1:$B$10,MATCH(A1,Sheet1!$A$1:$A$10,0))

[...] Re: Duplicates Originally Posted by proficient I want to find duplicates numbers in a range Duplicates Value A B C D 1 1 1 4 2 2 2 6 3 3 4 3 4 4 5 6 6 1 7 2 8 2 9 4 10 65 11 1 12 2 13 2 14 4 15 25 16 1 17 2 Spreadsheet Formulas Cell Formula D1 =COUNTIF($A$1:$A$17,C1) D2 =COUNTIF($A$1:$A$17,C2) D3 =COUNTIF($A$1:$A$17,C3) Excel tables to the web >> Excel Jeanie HTML 4 This seems to be what you are looking for: Extract a list of duplicates from a column using array formula in excel | Get Digital Help - Microso... [...]

It works for me.. Thanks men..

Will it really takes time to if the data is Big?

Tnx,

MIke, CPA

Jarvin Villones,

If you have a large data set it will take time. It all depends on your computer hardware.

Hiya Oscar,

Thank you for your awesome formula, its a bit too advanced for me to be honest but I do grasp the concept of it. I would like to ask you is it possible to encapsulate the formula in an if statement somehow? or as it is in my case "IF from London + IF this month + then PULL unique agent names" I did give it a try but the formula could not work :(

Thanks in advance!

Best Regards,

FB

Neophyte,

Read this:

Extract duplicates using conditions

Huge thank you for your fast response however this is truly outside my league :D (our office excel guru's league too as it seems)... I am trying to pull the "Unique" names rather than duplicates and I don't understand your formula in order to reverse it.

Any help on the subject will be highly appreciated!

THANK YOU!

Neophyte,

Array formula in cell A6:

Download excel *.xlsx file

Extract-duplicates-using-conditions_ver2.xlsx

The formulas can be smaller if you have space for a "helper column" in your sheet. The dates make the formulas complicated.

Hi Oscar

Extract a list of duplicates from a column using array formula, does not work for me ? I am using Ms Office 2012

Julio,

did you create an array formula?

Hi, very useful info here.. I can't seem to leave a comment on previous post "How to extract a unique distinct list from a column in excel" so i posted a reply to this thread instead. Sorry..

Anyways, my problem is I wanted to get the unique list only if one condition in one cell is True (Column B). I tried using if() statement but i guess there's something wrong. I know it's very easy for you.. Tnx a lot for your help.

Ex:

A B

1111 True

1232 False

1234 True

Lester,

Read this, I think it is what you are looking for.

Thanks a lot Oscar for your help... Just what i needed... :))

Hi Oscar,

I am using the unique formula you created in response to Neophyte in the comment above. However, I would like to copy the formula across instead of down. How would I modify the formula to accomplish this?

Thank you for the help!

Kyle

Hi Oscar,

Disregard my last question. I figured it out. I just changed the last row formula to column and it worked.

Thanks,

Kyle

How to convert(transpose) sing column to row.

Thanks,

Chethan kumar

How to convert(transpose) single column to row.

Thanks,

Chethan kumar

Reply

Hi,

Just wondering if I would use this formula to return a list so it would show all duplicates as one, and single entries as they are

ie This List: Green, Yellow, Red, Yellow, Blue, Black, Green, Yellow, Oragne, Blue, Green, Pink

To A list like this: Green, Yellow, Red, Blue, Black, Orange, Pink

Thanks

Got it, not to worry.

Iam trying to add this formula for my work but it doesnt work and it comes up with #Name? Please help

thnx

This function seems to ignore any entry in List1 that has only one entry... Is that correct?

Tried this function using a list from a different sheet in by workbook, for some reason it is listing the results in doubles. Any reason for this? Using Excel 2013.

Nate

Hard to say without seeing your workbook, you entered it as an array formula?

Hi Oscar,

Thanks for your formula, I would like to know how can the duplicate be shown in row and expand to the right? Please help!

Jackie,

(Click to see full size image)

The formula is the same:

=INDEX(List1, MATCH(0, COUNTIF(C1:$C$1, List1)+IF(COUNTIF(List1, List1)>1, 0, 1), 0)) + CTRL + SHIFT + ENTER.

Make sure the cell ref (bolded) is pointing to the next cell to the left, however this means you can't enter the formula in the first column.

I was able to adjust this to my project, but man does it take a long time to calculate. I have a spread sheet with about 4000 rows and it can take hours to calculate. Is there a faster way of doing this?

Hi Oscar, stumbled across this formula and it's quality!!! Your formula nearly works perfectly for me but how do I introduce an exception? Your formula finds and retrieves duplicate tennis players names, however if I wanted to exclude the name "Federer, Roger" from my results how would I do this? The list I am checking for duplicates has some legitimate duplicate text which I need to exclude from the returned results, thanks

Ben,

Thank you!

I have added your question to this post.

Read this: https://www.get-digital-help.com/2009/06/22/extract-a-list-of-duplicates-from-a-column-using-array-formula-in-excel/#exceptions