Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Message Box for Duplicates

Hi Everyone,

I have a Column where Numbers are Entered. There can be from 5 Numbers
to 200 or so Numbers. What I would like is to Check that there is NO
Duplicates in the Column Please.

Thanks in Advance.
All the Best.
Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Message Box for Duplicates

=IF(COUNTA(A1:A200)=SUMPRODUCT((A1:A200<"")/COUNTIF(A1:A200,A1:A200&"")),
"all the same","not all the same")


=SUMPRODUCT((A1:A200<"")/COUNTIF(A1:A200,A1:A200&""))
will give the count of unique items

=count(a1:a200) will count the number of numbers.

Paul Black wrote:

Hi Everyone,

I have a Column where Numbers are Entered. There can be from 5 Numbers
to 200 or so Numbers. What I would like is to Check that there is NO
Duplicates in the Column Please.

Thanks in Advance.
All the Best.
Paul


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Message Box for Duplicates

Thanks Dave,

How could I do it Using a Macro as well Please.

Thanks in Advance.
All the Best.
Paul

Dave Peterson wrote:
=IF(COUNTA(A1:A200)=SUMPRODUCT((A1:A200<"")/COUNTIF(A1:A200,A1:A200&"")),
"all the same","not all the same")


=SUMPRODUCT((A1:A200<"")/COUNTIF(A1:A200,A1:A200&""))
will give the count of unique items

=count(a1:a200) will count the number of numbers.

Paul Black wrote:

Hi Everyone,

I have a Column where Numbers are Entered. There can be from 5 Numbers
to 200 or so Numbers. What I would like is to Check that there is NO
Duplicates in the Column Please.

Thanks in Advance.
All the Best.
Paul


--

Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Message Box for Duplicates

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Columns(1), Target) Is Nothing Then
If Application.CountIf(Columns(1), Target.Value) 1 Then
MsgBox Target.Value & " already exists"
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub

This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Paul Black" wrote in message
oups.com...
Thanks Dave,

How could I do it Using a Macro as well Please.

Thanks in Advance.
All the Best.
Paul

Dave Peterson wrote:

=IF(COUNTA(A1:A200)=SUMPRODUCT((A1:A200<"")/COUNTIF(A1:A200,A1:A200&"")),
"all the same","not all the same")


=SUMPRODUCT((A1:A200<"")/COUNTIF(A1:A200,A1:A200&""))
will give the count of unique items

=count(a1:a200) will count the number of numbers.

Paul Black wrote:

Hi Everyone,

I have a Column where Numbers are Entered. There can be from 5 Numbers
to 200 or so Numbers. What I would like is to Check that there is NO
Duplicates in the Column Please.

Thanks in Advance.
All the Best.
Paul


--

Dave Peterson




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default Message Box for Duplicates

Excellent Bob.
Thanks very much.
All the Best.
Paul

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Condensing a list with duplicates to a list with non-duplicates Nuclear Excel Worksheet Functions 2 July 29th 08 08:03 PM
Duplicates in excel that aren't 100% DUPLICATES ... [email protected] Excel Discussion (Misc queries) 4 May 2nd 08 06:43 PM
Opening an attachment of a message that has a message as attachmen vetron Excel Programming 0 January 30th 06 06:17 PM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"