Matching two Cells

mmmarks

Active Member
Joined
Jun 4, 2011
Messages
428
Hi Friends,

Hopefully It will done by VBA UDF here is scenario...
Eg :1
In Cell A1 , I have ... "This is Monday "
In Cell B1, I have .. " This is Tuesday "

I need in C1, Tuesday.. ( as I need to get word(s) which are unmatch with A1 and Its not fixed length of sentence)

Eg 2 : A1, Hi How are you
B1, Hi How am I
Result in C1, am I


Thanks in advance..
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
This UDF should do it for you?

Code:
Function missing(rng1 As Range, rng2 As Range) As String
Dim arr1() As String
Dim arr2() As String
Dim storage As String
arr1 = Split(rng1.Value, " ")
arr2 = Split(rng2.Value, " ")
For Each a In arr2
    If IsError(Application.Match(a, arr1, 0)) Then
        storage = storage & a & " "
    End If
Next a
missing = Trim(storage)
End Function
Excel Workbook
AB
1This is MondayHi How are you
2This is TuesdayHi How am I
3Tuesdayam I
Sheet1
Cell Formulas
RangeFormula
A3=missing(A1,A2)
B3=missing(B1,B2)

Hope that helps.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,272
Messages
5,836,326
Members
430,420
Latest member
Sensen

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
Top