How can I identify which values are not in A that are in B?

Attached is a spreadsheet. I need to know what values are in B that are not in A.

Make sense?

Column A represents the files that are in a particular directory with several that were deleted. Column B represents all of the files that SHOULD be in that directory. How can I compare the columns and get a column that represents what's missing in column A?

Thanks!
mp3s.xlsx
brucegustPHP DeveloperAsked:
Who is Participating?
 
Martin LissConnect With a Mentor Older than dirtCommented:
In Excel, Press Alt+F11 to open the Visual Basic Editor (VBE)

Right-click on your workbook name in the "Project-VBAProject" pane (at the top left corner of the editor window). If you don’t see an existing module then select Insert -> Module from the context menu. Otherwise just select the module.

Copy the macro (you can use the ‘Select All’ button if you like) and paste it into the right-hand pane of the VBA editor ("Module1" window)

Press Alt+F11 again to go back to Excel

Optionally, press Alt+F8 to open the "Macro" dialog window. Select the macro, click ‘Options…’,  hold down the Shift key and type the letter A (or any other letter) and click ‘OK’. Then anytime you want to run the macro press Ctrl+Shift+A.

When you close the workbook you will need to save it as an xlsm or xls file if it’s not already one of those.
0
 
Martin LissOlder than dirtCommented:
Here's a macro you can use. It turns the cells in column B yellow if they aren't in column A.
Sub FindMissing()
Dim lngLastRow As Long
Dim lngRow As Long
Dim rngFound As Range

lngLastRow = Range("B1048576").End(xlUp).Row

Application.ScreenUpdating = False
Columns("A:A").Select
For lngRow = 2 To lngLastRow
    Set rngFound = Selection.Find(What:=Cells(lngRow, "B"), After:=ActiveCell, LookIn:=xlFormulas, LookAt _
        :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False)
    If rngFound Is Nothing Then
        Cells(lngRow, "B").Interior.Color = vbYellow
    End If
Next
Application.ScreenUpdating = True
End Sub

Open in new window

0
 
Martin LissOlder than dirtCommented:
Just reread your question and this puts the missing values in column C.
Sub FindMissing()
Dim lngLastRow As Long
Dim lngRow As Long
Dim rngFound As Range
Dim lngNR As Long

lngNR = 2
lngLastRow = Range("B1048576").End(xlUp).Row

Application.ScreenUpdating = False
Columns("A:A").Select
For lngRow = 2 To lngLastRow
    Set rngFound = Selection.Find(What:=Cells(lngRow, "B"), After:=ActiveCell, LookIn:=xlFormulas, LookAt _
        :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False)
    If rngFound Is Nothing Then
        Cells(lngNR, "C") = Cells(lngRow, "B")
        lngNR = lngNR + 1
    End If
Next
Application.ScreenUpdating = True
End Sub

Open in new window

0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
brucegustPHP DeveloperAuthor Commented:
Martin, no doubt this is an elegant piece of syntax, but I'm a pig on roller skates with this kind of stuff.

I've been google-ing to try and figure out how to install your macro and run it, but I'm not finding anything that resonates with what I can understand.

I've got my macro tab. I've found that. How do I take what you did, put it in place and run it?
0
 
brucegustPHP DeveloperAuthor Commented:
Awesome! Thank you!
0
 
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2016
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2015
0
All Courses

From novice to tech pro — start learning today.