Matching two Cells

mmmarks

Active Member
Joined
Jun 4, 2011
Messages
432
Office Version
  1. 2013
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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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.
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

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