## Highlight duplicate values in a cell range

*Article last updated on December 22, 2017*

**Question: **How do I highlight duplicate values in a range (A1:D4) using conditional formatting?

**Answer:**

**Conditional formatting formula:**

**Highlight all values having duplicates**

**Named ranges**

tbl (G5:J8)

What is named ranges?

**How to implement conditional formatting formula to your workbook in excel 2007**

For example, your range is D4:G9. Change named range *tbl *to D4:G9.

- Select your range D4:G9.
- Go to "Home" tab
- Click Conditional formatting
- Click "New Rule.."
- Click "Use a formula to determine what cells to format"
- Change A1 in the above conditional formatting formula to D4. Your range is D4:G9, remember?.
- Copy the above conditional formatting formula to "Format values where this formula is true:"
- Click Format button
- Select a formatting you like. For example, cells filled with yellow.
- Click OK
- Click OK

**Download excel *.xlsx file**

highlight-duplicate-values-in-a-range1.xlsx

### Functions in this article

**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

**ROW(**reference**)**

returns the row number of a reference

**COUNTIF(**range,criteria**)**

Counts the number of cells within a range that meet the given condition

**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

**MAX(**number1,[number2],**)
**Returns the largest value in a set of values. Ignores logical values and text.

**MATCH(**lookup_value;lookup_array; [match_type]

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

**COLUMN(**reference**)** Returns the column number of a reference

**MIN(**number1,[number2]**)**

Returns the smallest number in a set of values. Ignores logical values and text

Counting conditionally formatted cells (vba)

UPDATE: It is not possible to count conditionally formatted cells using vba as far as I know, I recommend you […]

Geoff asks: Hi Oscar, I have a cross reference table we use for shift scheduling. The x-axis is comprised of […]

Highlight dates in a date range

Question: How do I highlight dates that meet criteria using conditional formatting? Table of contents Highlight values in a column […]

This post decribes how to highlight records with closest value to a criterion. You can also choose to highlight the […]

This blog post shows you how to easily identify duplicate rows or records in a list. Conditional formatting formula: =COUNTIFS($B$3:$B$15, […]

How to highlight MAX and MIN value based on month

Conditional formatting formula to highlight max value in every month: =B2=MAX(IF(MONTH(A2)=MONTH(Date_rng), Close, "")) Conditional formatting formula to highlight min value […]

Here is how to highlight every other row using conditional formatting. Conditional formatting formula: =ISEVEN(ROW())*OR($B3:$D3<>"") Alternative CF formula: =EVEN(ROW())=ROW() This […]

Question: I have a list that I keep adding rows to. How do i create a border that expands as […]

Highlight records – multiple criteria [OR logic]

This blog post shows you how to highlight rows with multiple criteria using OR logic. The criteria is found in […]

Highlight duplicates in a filtered Excel defined table

You can highlight duplicates in an excel defined table using conditional formatting. However, that won´t work if you only want […]

### 2 Responses to “Highlight duplicate values in a cell range”

### Leave a Reply

### 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 < and > becomes >

**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

Use the img tag, like this: <img src="Insert pic link here">

**Contact Oscar**

You can contact me through this contact form

When you modiy to move to anu other column apart from 'A' the the first instance of the duplicate also highlights.

David Gordon,

You are right, I believe the new formula I have added to this post is more useful.

Thanks for commenting!