Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 2 cells that I need to compare
In each cell there are name of student separated by coma so A1= Bill,Marco A2= Bill,John,Marco,Bella How can I have the unmatching names (name in A2 but not in A1) in A3 So A3 should be John,Bella Any idea? Thanks Dan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this User Defined Function:
Option Explicit Function compare(text1 As String, text2 As String) As String 'find items in text2 that are not in text1 Dim vtext2 As Variant Dim vtext1 As Variant Dim res As String Dim txt As String Dim index1 As Long Dim index2 As Long Dim bFound As Boolean vtext1 = Split(text1, ",") vtext2 = Split(text2, ",") For index2 = LBound(vtext2, 1) To UBound(vtext2, 1) txt = "" bFound = False For index1 = LBound(vtext1, 1) To UBound(vtext1, 1) If vtext1(index1) = vtext2(index2) Then bFound = True Exit For End If Next If Not bFound Then res = res & "," & vtext2(index2) End If Next compare = Mid(res, 2) End Function "Dan" wrote: I have 2 cells that I need to compare In each cell there are name of student separated by coma so A1= Bill,Marco A2= Bill,John,Marco,Bella How can I have the unmatching names (name in A2 but not in A1) in A3 So A3 should be John,Bella Any idea? Thanks Dan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
change this
Set rng = Intersect(Target, Range("E:E")) to Set rng = Intersect(Target, Range("E:E;H:Q")) "Dan" wrote: I have 2 cells that I need to compare In each cell there are name of student separated by coma so A1= Bill,Marco A2= Bill,John,Marco,Bella How can I have the unmatching names (name in A2 but not in A1) in A3 So A3 should be John,Bella Any idea? Thanks Dan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
oops. replied to wrong mail.sorry
"Patrick Molloy" wrote: change this Set rng = Intersect(Target, Range("E:E")) to Set rng = Intersect(Target, Range("E:E;H:Q")) "Dan" wrote: I have 2 cells that I need to compare In each cell there are name of student separated by coma so A1= Bill,Marco A2= Bill,John,Marco,Bella How can I have the unmatching names (name in A2 but not in A1) in A3 So A3 should be John,Bella Any idea? Thanks Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
compare 2 column cells and return the adjacent columns cells data of the cell | Excel Worksheet Functions | |||
Compare 1 cell to column of cells returning adjacent cells info? | Excel Worksheet Functions | |||
How do I compare cells and if FALSE compare to next cell in EXCEL | Excel Worksheet Functions | |||
Compare two cells from reference cells | Excel Worksheet Functions | |||
Compare 2 cells in 2 worksheets, rewrite one of the cells | Excel Programming |