VBA identify unmatched data

psrs0810

Well-known Member
Joined
Apr 14, 2009
Messages
1,109
I need to automate a way to look at two tables and within those two table, concatenate two columns. Where there is not a match to put the unmatched information at the bottom.

i.e. I have one ws labeled "ChargeDetail", with columns C and D needing to be concatenated. then compare this information in ws "VolDriver" with columns C and B concatenated. if there is any items that are unmatched, to put them at the bottom of VolDriver.

Thanks
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Use an extra column for EXISTS (D2)

Spreadsheet Formulas
CellFormula
D2{=IFERROR(MATCH(VolDriver!C2&B2,ChargeDetail!$A$2:$C$2&$D$2:$B$5,0)>0,FALSE)}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>

Sort on this column.
 
Upvote 0
Thank you mart37, but I am looking for a macro. I need to have this in a more automated fashion.
Thanks
 
Upvote 0
Try this:-
NB:- The code will transfer 4 columns of "Unmatched" data, See:- Code Remarks
Code:
[COLOR=navy]Sub[/COLOR] MG18Sep43
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range, n [COLOR=navy]As[/COLOR] [COLOR=navy]Long,[/COLOR] Txt [COLOR=navy]As[/COLOR] [COLOR=navy]String,[/COLOR] c [COLOR=navy]As[/COLOR] [COLOR=navy]Long[/COLOR]
[COLOR=navy]With[/COLOR] Sheets("VolDriver")
    [COLOR=navy]Set[/COLOR] Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
    Txt = Dn.Offset(, 2).Value & Dn.Offset(, 1).Value
        .Item(Txt) = Empty
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]With[/COLOR] Sheets("ChargeDetail")
    [COLOR=navy]Set[/COLOR] Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
[COLOR=navy]End[/COLOR] With
    [COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
        Txt = Dn.Offset(, 2).Value & Dn.Offset(, 3).Value
            [COLOR=navy]If[/COLOR] Not .exists(Txt) [COLOR=navy]Then[/COLOR]
                c = c + 1
           [B][COLOR=#008000] 'Change "4" (2 positions) below to add extra columns[/COLOR][/B]
             Sheets("VolDriver").Range("A" & .Count + c).Resize(, 4).Value = Dn.Resize(, 4).Value
            [COLOR=navy]End[/COLOR] If
    [COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] With
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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