Find Duplicate

gnusmas

Board Regular
Joined
Mar 5, 2014
Messages
186
Hi Friend i have sheet with the following values my last range is a refenrence.
I need <acronym title="visual basic for applications">vba</acronym> code to find duplicate IF the neighbors values "+1" OR "-1".
Exemple:


<tbody>
[TD="class: xl63"]11[/TD]
[TD="class: xl63, width: 19"]12[/TD]
[TD="class: xl63, width: 19"]14[/TD]
[TD="class: xl63, width: 19"]22[/TD]
[TD="class: xl63, width: 19"]31[/TD]
[TD="class: xl63, width: 19"]47[/TD]

[TD="class: xl63"]06[/TD]
[TD="class: xl63"]13[/TD]
[TD="class: xl63"]28[/TD]
[TD="class: xl63"]29[/TD]
[TD="class: xl63"]42[/TD]
[TD="class: xl63"]43[/TD]

[TD="class: xl63"]21[/TD]
[TD="class: xl63"]23[/TD]
[TD="class: xl63"]27[/TD]
[TD="class: xl63"]28[/TD]
[TD="class: xl63"]33[/TD]
[TD="class: xl63"]48[/TD]

[TD="class: xl63"]01[/TD]
[TD="class: xl63"]05[/TD]
[TD="class: xl63"]11[/TD]
[TD="class: xl63"]20[/TD]
[TD="class: xl63"]22[/TD]
[TD="class: xl63"]30[/TD]

[TD="class: xl63"]16[/TD]
[TD="class: xl63"]18[/TD]
[TD="class: xl63"]24[/TD]
[TD="class: xl63"]29[/TD]
[TD="class: xl63"]36[/TD]
[TD="class: xl63"]44[/TD]

</tbody>


<tbody>
[TD="class: xl65"]16[/TD]
[TD="class: xl65, width: 19"]25[/TD]
[TD="class: xl65, width: 19"]34[/TD]
[TD="class: xl65, width: 19"]41[/TD]
[TD="class: xl65, width: 19"]45[/TD]
[TD="class: xl65, width: 19"]47[/TD]

[TD="class: xl65"]15[/TD]
[TD="class: xl65"]32[/TD]
[TD="class: xl65"]35[/TD]
[TD="class: xl65"]36[/TD]
[TD="class: xl65"]42[/TD]
[TD="class: xl65"]47[/TD]

[TD="class: xl65"]06[/TD]
[TD="class: xl65"]08[/TD]
[TD="class: xl65"]27[/TD]
[TD="class: xl65"]28[/TD]
[TD="class: xl65"]31[/TD]
[TD="class: xl65"]47[/TD]

[TD="class: xl65"]13[/TD]
[TD="class: xl65"]14[/TD]
[TD="class: xl65"]20[/TD]
[TD="class: xl65"]28[/TD]
[TD="class: xl65"]29[/TD]
[TD="class: xl65"]33[/TD]

[TD="class: xl65"]09[/TD]
[TD="class: xl65"]11[/TD]
[TD="class: xl65"]16[/TD]
[TD="class: xl65"]19[/TD]
[TD="class: xl65"]42[/TD]
[TD="class: xl65"]44[/TD]

</tbody>

Sheet 2 Result


<tbody>
[TD="class: xl65"]29[/TD]

[TD="class: xl65"]28[/TD]

[TD="class: xl65"]20[/TD]

</tbody>


<tbody>
[TD="class: xl65"]28[/TD]

[TD="class: xl65"]28[/TD]

[TD="class: xl65"]19


<tbody>
[TD="class: xl65"]28[/TD]
[TD="class: xl65, width: 19"] 33[/TD]
[TD="class: xl65, width: 19"] 48[/TD]

</tbody>
[/TD]

</tbody>


<tbody>
[TD="class: xl65"][/TD]
[TD="class: xl65, width: 19"]47[/TD]

[TD="class: xl65"]29[/TD]
[TD="class: xl65"]33[/TD]

</tbody>
Etc...

Thank you for Help!!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
clear as mud to me

define neighbours

are neighbours up down left right and diagonal

no takers after this time means people do not understand what you want usually....
 
Upvote 0
Thank you friend I apreciate your help !!
Yes the neighbours are up down left right and diagonal!!
Another exemple :

[TABLE="width: 114"]
<tbody>[TR]
[TD="class: xl63, width: 19"]01[/TD]
[TD="class: xl63, width: 19"]02[/TD]
[TD="class: xl63, width: 19"]12[/TD]
[TD="class: xl63, width: 19"]30[/TD]
[TD="class: xl63, width: 19"]40[/TD]
[TD="class: xl63, width: 19"]47[/TD]
[/TR]
[TR]
[TD="class: xl63"]09[/TD]
[TD="class: xl63"]10[/TD]
[TD="class: xl63"]17[/TD]
[TD="class: xl63"]18[/TD]
[TD="class: xl63"]22[/TD]
[TD="class: xl63"]47[/TD]
[/TR]
[TR]
[TD="class: xl63"]01[/TD]
[TD="class: xl63"]21[/TD]
[TD="class: xl63"]30[/TD]
[TD="class: xl63"]36[/TD]
[TD="class: xl63"]45[/TD]
[TD="class: xl63"]48[/TD]
[/TR]
[TR]
[TD="class: xl63"]04[/TD]
[TD="class: xl63"]06[/TD]
[TD="class: xl63"]20[/TD]
[TD="class: xl63"]29[/TD]
[TD="class: xl63"]31[/TD]
[TD="class: xl63"]37[/TD]
[/TR]
[TR]
[TD="class: xl63"]13[/TD]
[TD="class: xl63"]20[/TD]
[TD="class: xl63"]24[/TD]
[TD="class: xl63"]25[/TD]
[TD="class: xl63"]29[/TD]
[TD="class: xl63"]44[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 114"]
<tbody>[TR]
[TD="class: xl65, width: 19"]11[/TD]
[TD="class: xl65, width: 19"]12[/TD]
[TD="class: xl65, width: 19"]14[/TD]
[TD="class: xl65, width: 19"]22[/TD]
[TD="class: xl65, width: 19"]31[/TD]
[TD="class: xl65, width: 19"]47[/TD]
[/TR]
[TR]
[TD="class: xl65"]06[/TD]
[TD="class: xl65"]13[/TD]
[TD="class: xl65"]28[/TD]
[TD="class: xl65"]29[/TD]
[TD="class: xl65"]42[/TD]
[TD="class: xl65"]43[/TD]
[/TR]
[TR]
[TD="class: xl65"]21[/TD]
[TD="class: xl65"]23[/TD]
[TD="class: xl65"]27[/TD]
[TD="class: xl65"]28[/TD]
[TD="class: xl65"]33[/TD]
[TD="class: xl65"]48[/TD]
[/TR]
[TR]
[TD="class: xl65"]01[/TD]
[TD="class: xl65"]05[/TD]
[TD="class: xl65"]11[/TD]
[TD="class: xl65"]20[/TD]
[TD="class: xl65"]22[/TD]
[TD="class: xl65"]30[/TD]
[/TR]
[TR]
[TD="class: xl65"]16[/TD]
[TD="class: xl65"]18[/TD]
[TD="class: xl65"]24[/TD]
[TD="class: xl65"]29[/TD]
[TD="class: xl65"]36[/TD]
[TD="class: xl65"]44[/TD]
[/TR]
</tbody>[/TABLE]

30 36 45 in range A1:F5

29 36 44 in range A7:F11

Ray = Array(Array(0, 1), Array(1, 1), Array(1, 0), Array(1, -1), Array(0, -1), Array(-1, -1), Array(-1, 0), Array(-1, 1))

I hope you understand my exemple!
 
Upvote 0
30 36 45 in range A1:F5

30 36 45 in range A7:F11

"36" in the second exemple and it is duplicate when you look the values left and right the neighbors +1,-1
30 36 45
29 36 44
I hope it help you!!
 
Upvote 0

Forum statistics

Threads
1,222,414
Messages
6,165,892
Members
451,992
Latest member
kaurmanjodh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top