Excel.Tips.Net ExcelTips (Menu Interface)

Ensuring Unique Values in a Column

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Ensuring Unique Values in a Column.

When you are entering information in a worksheet, you may want to ensure that the data being entered is actually unique for a particular column. For instance, if you are entering a series of invoice numbers in column D of a worksheet, you may want to ensure that you don't enter the same invoice number twice.

There are a couple of ways that you can approach such a problem. If you are always entering your new information at the bottom of a column, you can use Excel's data validation feature to make sure that whatever you are entering in the current cell does not match anything higher up in the column. Simply follow these steps:

  1. Select column D.
  2. Choose Validation from the Data menu. Excel displays the Data Validation dialog box. (See Figure 1.)
  3. Figure 1. The Data Validation dialog box.

  4. Using the Allow drop-down list, choose the Custom option.
  5. In the Formula box, enter the following formula:
  6.      =MATCH(D1,$D:$D,0)=ROW(D1)
  7. Click on OK.

If you may be entering data anyplace within column D, and you want to know if you are entering a value that is elsewhere in the column (above or below the current cell), then you can follow the above steps, but use this formula in step 4:


ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2650) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Ensuring Unique Values in a Column.

Related Tips:

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Jenni    06 May 2016, 11:41
This formula worked great when I tested it in a blank excel worksheet. But, when I tried it within my existing table it did not work :( Got any idea of how to get it to work in a table? Seems like there's a lot of things that don't work well within a table in excel. Thanks, Jenni
Kadr Leyn    23 Jan 2016, 13:07
Thanks for tutorial.

Vba codes can be used in this topic:

"Excel Data Validation List With Unique Values"

Template's video :https://www.youtube.com/watch?v=LiIpObVus7o

mac    13 Jan 2016, 12:33
I must be missing something?
running MS Office 2016
not getting any messages
billyg    23 Nov 2015, 08:08
manpreet    12 Aug 2015, 19:19
I want to avoid duplicate data in a comibnation of columns like

Valid Data
Date | Shift
08 Aug | Night
08 Aug | Day

Example of INVALID data
Date | Shift
08 Aug | Night
08 Aug | Night

So I have to avoid entry of duplicate data in a combination of columns. I am not able to figure it out please help.
sachi    16 Jun 2015, 02:53
thank you for this tip
Akshay    18 Aug 2014, 02:30
Thanks for the tip!
Michael (Micky) Avidan    14 Nov 2013, 07:47

In order to avoid duplicate typing and/or copying - try th following Event-macro to be placed in the Worksheets module.
The "traditional" Data Validation is not needed in that case.

*** The macro refers to Column "A".

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim C As Range, i As Long
  If Not Intersect(Target, Me.[A:A]) Is Nothing Then
     Application.EnableEvents = False
     For Each C In Target
       If C.Column = 1 And C.Value > "" Then
          If WorksheetFunction.CountIf(Me.[A:A], C.Value) > 1 Then
             i = C.Interior.ColorIndex
             f = C.Font.ColorIndex
             C.Interior.ColorIndex = 3 ' Red
             C.Font.ColorIndex = 6 ' Yellow
              MsgBox "Watch Out !!! - Duplicate Entry !", vbCritical, "Error"
             C.Interior.ColorIndex = i
             C.Font.ColorIndex = f
          End If
       End If
     Application.EnableEvents = True
  End If
End Sub

Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2014)
Ole    13 Nov 2013, 22:37
Hi Allen,

I thought to let you know that the current formula I am using is:


Kind Regards,
Ole    13 Nov 2013, 22:35
Hi Allen,

Thanks for your tips regarding unique values in a column - worked a treat.
I wanted to extend this info and allow unique values for the column cell range based on a list.
I have already created a form combo box with a list of four values that are in the column N1, N2, N3 and N4.
I would like the unique values only based on the selection in the drop down list.
Can you help me?

Kind Regards,
Yesenia Bernal    10 Jun 2013, 14:50
Hello Allen,

I tried you how to enter values in a column and it worked great. I just have a question it there's a way for it to when you paste numbers not just entered numbers.

Thank you,
Yesenia Bernal
Elaine Wilson    02 Jun 2012, 15:40
Thank you such a useful formula

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2017 Sharon Parq Associates, Inc.