Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The Scenerio:
Set A = 1,2,3,4,5 (lets the numbers are in E2 to I2) Set B = 1,2,6,7,8 (lets the numbers are in E3 to I3) Now how to find the following problems: 1. Set A union set B in cell A10 (i.e in A10 cell the numbers should be 1, 2, 3, 4, 5, 6, 7, 8) 2. Set A Intersection Set B in cell A11 (i.e. in A11 cell the numbers should be 1, 2) 3. Uncommon numbers between Set A and Set B in cell A12 (i.e. in A12 cell the numbers should be 3, 4, 5, 6, 7, 8) Could anyone can help me to solve this problem? Thanks Sadi |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sep 5, 12:27*pm, SADEQ AHMAD CHOWDHURY wrote:
The Scenerio: Set A = 1,2,3,4,5 (lets the numbers are in E2 to I2) Set B = 1,2,6,7,8 (lets the numbers are in E3 to I3) Now how to find the following problems: 1. Set A union set B in cell A10 (i.e in A10 cell the numbers should be 1, 2, 3, 4, 5, 6, 7, 8) 2. Set A Intersection Set B in cell A11 (i.e. in A11 cell the numbers should be 1, 2) 3. Uncommon numbers between Set A and Set B in cell A12 (i.e. in A12 cell the numbers should be 3, 4, 5, 6, 7, 8) Could anyone can help me to solve this problem? Thanks Sadi Give this a try: Sub cutaneous() Dim A As Range, B As Range, C As Range Dim A10 As Range, A11 As Range Set A = Range("E2:I2") Set B = Range("E3:I3") Set C = Union(A, B) Set A10 = Range("A10") Set A11 = Range("A11") A10 = "" A11 = "" Dim coll As Collection Set coll = New Collection On Error Resume Next For Each r In C v = r.Value coll.Add v, CStr(v) If Err.Number = 0 Then A10.Value = A10.Value & "," & v Else A11.Value = A11.Value & "," & v Err.Number = 0 End If Next v10 = A10.Value v11 = A11.Value A10.Value = Right(v10, Len(v10) - 1) A11.Value = Right(v11, Len(v11) - 1) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Intersect and Union | Excel Programming | |||
Intersect or Union? | Excel Programming | |||
Intersect or Union? | Excel Programming | |||
Complex Union Intersect | Excel Worksheet Functions | |||
Intersect, Union... where's Deduct? | Excel Programming |