Sunteți pe pagina 1din 16

Get

Digital
Help
More

Home
Functions
Excel Function Reference A to Z Compatibility Database Date & Time Engineering Financial
Information Logical Lookup & Reference Math & Trigonometry Statistical Text Web
Formulas
Basic formulas Advanced formulas
Features
Excel defined table Advanced filter Data Validation Drop down lists Named ranges Solver
Charts
Conditional formatting
Pivot table
VBA
VBA Functions Methods Properties Statements Macros User defined functions Files & folders
Checkboxes
Archive
All articles sorted by date Categories Products Advanced Excel Course
Contact
About me Blogs I read

Advanced formulas

Concatenate

Based on a condition
Unique distinct values
Drop-down list
Join without TEXTJOIN
Lookup & return values

Compare

Shared values 2 cols


Extract missing values
Missing values two cols
Missing values 2 cols
Extract not shared vals
Values shared by 2 rngs
Vals not shared 2 rngs
Records in two tables
Common records
Two price lists
Common values 3 lists
Criteria, two lists
Update recent values
Update recent values(2)
Sums, return unique
Values shared by 3 rngs

Combine merge

Merge tables
Merge rows - condition
Combine ranges [UDF]
Merge matching rows
Merge 2 cols w. blanks
Consolidate sheets
Combine sheets
Merge two columns
Merge 3 columns

Count values

Pattern in cell value


Overlapping time
Containing any list value
Unique distinct/condition
Count colored cells
Equal values per row
Count overlapping days
Sort count freq. condi.
Count overlap. days(2)
Count overlap. days(1)
Contiguous values
Count students
Inventory consumption
Count filtered table
Groups of each value
Weekday in date range
Weekday date range(2)
Cells between value
Entries date & time rng
Unique distinct - criteria
Unique dist. rec. criteria
Digits - no duplicates
Based on criteria
Count groups in calendar
Uniq. dist. based dates
Count based on date
Numbers across sheets
Cells between values
Most freq/date range
Unique distinct months
Uniq. dist. 2 cols
Unique dist. values

Dates

Schedule -> date rngs


Overlapping time
Count overlapping days
Date from week & day
Count overlap. days(2)
Count overlap. days(1)
Missing dates
Overlap. date ranges
Overlapping ranges
Find overlap. ranges
Min/max date overlap.
Date ranges overlap
Consecutive dates
Count overlap days
Overlap holidays
Prevent overlapping
Find date range
Inventory consumption
Search related data
Create date ranges
Weekday in date range
Calc dates in project
Weeks from ranges
Weekday date range(2)
Entries date & time rng
Overlap. date ranges
Overlap rngs - condition
Count groups in calendar
Dates from overlap rngs
Dates from date rngs
Date rngs from dates
Dates not in rngs
Overlapping ranges
Based on date criteria
Date, week, month
Dupes - date, wk, month
Year - month from dates
Match date in date rng
Latest date - condition
Most freq/date range
Find min/max date rng
Blank between quarters
Dupe vals sorted date
Create date range
Lookup the nearest date
Based on a date range
Machine utilization
Date based on wkday

Find numbers in sum

Numbers closest to sum


No net close to zero
Find numbers in sum
Numbers in sum

Overlapping

Overlapping time
Count overlapping days
Count overlap. days(2)
Count overlap. days(1)
Missing dates
Overlap. date ranges
Overlapping ranges
Find overlap. ranges
Min/max date overlap.
Date ranges overlap
Count overlap days
Overlap holidays
Prevent overlapping
Overlap. date ranges
Overlap rngs - condition
Overlapping ranges

Unique values

Case sensitive
Unique strings [UDF]
Sort digits in rng
Based on date criteria
From range
Sort unique A-Z
Min unique number
Sort based on date
Sum if unique
Two columns
One column

Unique distinct values

One column
Two columns
Three columns
Remove blanks
Uniq. dist. - condition
Adjacent contains string
Adjacent has text
Contains string
Based on criteria
Sorted frequency
Sorted by sum
Sorted alphabetically
Sorted A->Z
Sorted & no blanks - rng
Sort length
From a cell range
Sorted A-Z from range
Contains string in rng
Begins with criterion
Based on a date range
Based on dates
Year - month from dates
Based on date criteria
Extract filtered table
Extract & sum condition
Two conditions
Sum uniq. dist. rec.
Assign randomly unique
Sums, return unique
Sorted, no blanks - rng

Duplicate values

Dupes A-Z condition


Dupes w. exceptions
Filter duplicate values using critera
Label duplicate records
Dupes - date, wk, month
Dupes from rng contain
Filter dupes begins w.
Min unique number
Dupe vals sorted date
Sort dupes A-Z
Dupes from range
Dupes from 3 cols
Dupes from 1 col
Dupes from 2 cols
Create a list of duplicates where adjacent cell value meets a condition

Sort values

Sort a column A-Z


Sort from 2 cols A-Z
Sort rng A-Z
Sort column - frequency
Frequency - criteria
Sort rng - frequency
Sort count freq. condi.
Sort two columns
Sort records
Sort table
Sort adj. txt horiz. (1)
Sort monthly
Sort table custom
Lookup/Sort custom
Sort random order
Sort based on length
Reverse list
Sort dupes A-Z
Sort unique A-Z
Sort unique A-Z blanks
Sort cell delimiter [VBA]
Sort Excel table [VBA]
Sort based on proximity
Sort dates - criteria

Vlookup function

VLOOKUP function
Discount percentages
Multiple conditions
Lookup values in rng
Lookup value in rng
Three columns
Two datasets

Vlookup and return multiple values

5 easy ways
Multiple conditions
Sorted from A to Z
Sorted A-Z - condition
Multiple conditions
Vlookup range
Vlookup rng - records
Vlook col - return rng
1 result per search
Horizontal vlookup
Vlookup - Drop-down
Multiple sheets

Search and return multiple values

Nested Search
Multiple conditions
Interactive formula
Search for string
Search records
Wildcard vlookup
Multiple strings
Criteria - AND logic
Strings in any 2 cols
Strings in 2 cols each
Strings in column
Contains string - column

Filter records

Extract using criteria


Extract using criteria(2)
Extract using criteria(3)
Recs betw. this & that
Records betw. 2 dates
Date range & condition
Search text string
Filter neg. values
Containing digits

Records

Not shared records


Sort table custom
Records [AND logic]
Records in two tables
Unique records
Common records
Common records
Duplicate columns

Unique distinct records

Extract unique distinct records from two data sets


Filter unique distinct records using criteria
Count uniq. dist. [2010]
Unique dist. rec. criteria
Records - condition(2)
Records - condition(1)
Filter unique distinct records

Count unique distinct records

Count unique distinct records

Duplicate records

Extract duplicate records

Count records

report this ad

Extract duplicate records

Author: Oscar Cronquist Article last updated on February 16, 2018


This article describes how to filter duplicate rows with the use of a formula.  It is, in fact, an array
formula which is demonstrated below. The function that makes this all possible is the COUNTIFS
function, introduced in Excel 2007.

The COUNTIFS function evaluates criteria to cells across multiple ranges and counts the number of times
all criteria are met.
Array formula in cell A30:

=INDEX($A$2:$D$25, SMALL(IF(COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25,


$C$2:$C$25, $C$2:$C$25, $D$2:$D$25, $D$2:$D$25)>1, ROW($A$2:$A$25)-MIN(ROW($A$2:$A$25))+1),
ROW(A1)), COLUMN(A1)) + CTRL + SHIFT + ENTER
Copy cell A30 and paste it to the right as far as needed. Then copy cells and paste them down as far as
needed.

How this formula works in cell A30

Step 1 - Find duplicates

=INDEX($A$2:$D$25, SMALL(IF(COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25,


$C$2:$C$25, $C$2:$C$25, $D$2:$D$25, $D$2:$D$25)>1, ROW($A$2:$A$25)-
MIN(ROW($A$2:$A$25))+1), ROW(A1)), COLUMN(A1)

COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25, $C$2:$C$25, $C$2:$C$25, $D$2:$D$25,


$D$2:$D$25)>1

returns this array:

{False, False, True, False, False, False, True, True, True, True, True, True, True, False, True, True, True,
True, True, False, True, True, True, True}

Step 2 - Use array to extract row numbers

IF({False, False, True, False, False, False, True, True, True, True, True, True, True, False, True, True,
True, True, True, False, True, True, True, True}, ROW($A$2:$A$25)-MIN(ROW($A$2:$A$25))+1)

becomes

IF({False, False, True, False, False, False, True, True, True, True, True, True, True, False, True, True,
True, True, True, False, True, True, True, True}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24})

and returns this array:

{False, False, 3, False, False, False, 7, 8, 9, 10, 11, 12, 13, False, 15, 16, 17, 18, 19, False, 21, 22, 23, 24}

Step 3 - Return the k-th smallest value

SMALL(IF(COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25, $C$2:$C$25, $C$2:$C$25,


$D$2:$D$25, $D$2:$D$25)>1, ROW($A$2:$A$25)-MIN(ROW($A$2:$A$25))+1), ROW(A1))

becomes

SMALL({False, False, 3, False, False, False, 7, 8, 9, 10, 11, 12, 13, False, 15, 16, 17, 18, 19, False, 21, 22, 23,
24}, ROW(A1))
and returns 3.

Step 4 - Return a value of the cell at the intersection of a particular row and column

=INDEX($A$2:$D$25, SMALL(IF(COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25,


$C$2:$C$25, $C$2:$C$25, $D$2:$D$25, $D$2:$D$25)>1, ROW($A$2:$A$25)-MIN(ROW($A$2:$A$25))+1),
ROW(A1)), COLUMN(A1))

becomes

=INDEX($A$2:$D$25, 3, COLUMN(A1))

becomes

=INDEX($A$2:$D$25, 3, 1) and returns "Sample1"

Final notes

The formula uses relative and absolute cell references.

In cell B30 the array formula changes cell references to:

=INDEX($A$2:$D$25, SMALL(IF(COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25,


$C$2:$C$25, $C$2:$C$25, $D$2:$D$25, $D$2:$D$25)>1, ROW($A$2:$A$25)-MIN(ROW($A$2:$A$25))+1),
ROW(A1)), COLUMN(B1))

In cell A31 the formula changes cell references to:

=INDEX($A$2:$D$25, SMALL(IF(COUNTIFS($A$2:$A$25, $A$2:$A$25, $B$2:$B$25, $B$2:$B$25,


$C$2:$C$25, $C$2:$C$25, $D$2:$D$25, $D$2:$D$25)>1, ROW($A$2:$A$25)-MIN(ROW($A$2:$A$25))+1),
ROW(A2)), COLUMN(A2))

Download excel sample file for this tutorial.

Filter duplicate rows in excel 2007.xlsx


(Excel 2007 Workbook *.xlsx)

Recommended blog post


Automatically filter unique distinct row records
Highlight duplicate rows in excel 2007

Functions used in this formula:


IF(logical_test, [value_if_true], [value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE

MATCH(lookup_value;lookup_array; [match_type])
Returns the relative position of an item in an array that matches a specified value

INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given
range

COUNTIFS(criteria_range1,criteria1, criteria_range2, criteria2...)
Counts the number of cells specified by a given set of conditions or criteria

SMALL(array,k) returns the k-th smallest row number in this data set.

ROW(reference) returns the rownumber of a reference

MIN(number1,[number2])
Returns the smallest number in a set of values. Ignores logical values and text

Related articles

report this ad

Comments (2)

2 Responses to “Extract duplicate records”

. richard reeves says:


December 7, 2018 at 12:20 pm

Hi

How would i go about just looking if data matched in just one column ?

so get the row extracted based on matching values in column 3?

Reply
Oscar says:
December 7, 2018 at 2:18 pm

richard reeves

Try this:

=INDEX($A$2:$D$25, SMALL(IF(COUNTIF($C$2:$C$25,$C$2:$C$25)>1,ROW($A$2:$A$25)-
MIN(ROW($A$2:$A$25))+1),ROW(A1)),COLUMN(A1))

My example has only 10 and 11 in column C so all records are extracted. (10 and 11 are duplicates.)

Leave a Reply

Name (required)

Mail (will not be published) (required)

Website

Notify me of followup comments via e-mail

How to comment

How to add a formula to your comment


<code>Insert your formula here.</code>

Convert less than and larger than signs


Use html character entities instead of less than and larger than signs.
< becomes &lt; and > becomes &gt;

How to add VBA code to your comment


[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]

How to add a picture to your comment:


Upload picture to postimage.org or imgur
Paste image link to your comment.

Contact Oscar

You can contact me through this contact form


report this ad

Website Search Search

Weekly Blog EMAIL

Get a FREE PDF book!

Email
Subscribe

Welcome! I am Oscar and here to help you out.

Feel free to comment and ask Excel questions.

Make sure you subscribe to my newsletter so you don't miss new blog articles.

Search website
Custom Search

Search

S-ar putea să vă placă și