ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying Duplicates (https://www.excelbanter.com/excel-programming/287268-identifying-duplicates.html)

Nigel[_8_]

Identifying Duplicates
 
Hi All
In a VBA procedure I have 5 integer numbers held in 5 different variables,
n1 to n5. I want to identify if any combination of these values are
duplicated and to highlight which ones.

So if the values are
1,2,3,4,5 - No duplicates All Ok
1,1,3,4,5 - Two duplicates - positions1 and 2
1,1,3,1,5 - Three duplicates - positions 1, 2 and 4
1,1,3,4,4 - Four duplicates - postions 1,2,4 and 5
1,1,1,1,1 - Five Duplicates - positions 1,2,3,4 and 5

I guess I need to loop through each variable testing each other variable for
match or not and log any errors and positions.

Any ideas on the best approach

Cheers
TIA
Nigel





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

Cliff Myers

Identifying Duplicates
 
Check out this page.
http://www.cpearson.com/excel/duplic...tingDuplicates
HTH

"Nigel" wrote in message
...
Hi All
In a VBA procedure I have 5 integer numbers held in 5 different variables,
n1 to n5. I want to identify if any combination of these values are
duplicated and to highlight which ones.

So if the values are
1,2,3,4,5 - No duplicates All Ok
1,1,3,4,5 - Two duplicates - positions1 and 2
1,1,3,1,5 - Three duplicates - positions 1, 2 and 4
1,1,3,4,4 - Four duplicates - postions 1,2,4 and 5
1,1,1,1,1 - Five Duplicates - positions 1,2,3,4 and 5

I guess I need to loop through each variable testing each other variable

for
match or not and log any errors and positions.

Any ideas on the best approach

Cheers
TIA
Nigel





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---






All times are GMT +1. The time now is 07:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com