Matching two Cells

mmmarks

Active Member
Joined
Jun 4, 2011
Messages
427
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..
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,939
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,514
Messages
5,596,609
Members
414,081
Latest member
penguin23

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