How to display the cell value(s) searched for but not found in a list? (Excel)

spraff

New Member
Joined
Oct 8, 2014
Messages
18
List A has the following sites: x, y, z


List B has the following sites: x, y, z, a, b, c


What formula will reveal to me that sites a, b, and c are in the range I'm looking at but missing not listed in List A?

Reason: I'm have a countif formula looking for the counts of reports created for various sites - but sometimes that site list grows but hasn't quite grown on my formula :rolleyes:
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Copy the formula in C2 down after you adjust the A-range to include all data cells in col A.
Excel Workbook
ABC
1List AList BMissing in Col A?
2xx 
3yy
4zz
5aYes
6bYes
7cYes
Sheet2
 
Upvote 0
Using code:
Search from the other list.
Code:
'psuedo code
Dim c As Range
For Each c In Range("List B")
 If Application.CountIf(Range("ListA")) = 0 Then
  MsgBox "Item " & c.Value & " not found." 'you can sent it to a range instead of msgbox.
 End If
Next
 
Upvote 0
Using code:
Search from the other list.
Code:
'psuedo code
Dim c As Range
For Each c In Range("List B")
 If Application.CountIf(Range("ListA")) = 0 Then
  MsgBox "Item " & c.Value & " not found." 'you can sent it to a range instead of msgbox.
 End If
Next

So I'm pretty green when it comes to VBA... if my ranges

'2014 Q3'!D:D and 'Report Stats'!A:A and I'm looking for values such as "Beijing R/D, CHINA (BEI)", "Hong Kong, CHINA (HKG)", "Melbourne, AUSTRALIA (MLB)", etc... how would the above look?
 
Upvote 0
Assuming '2014 Q3'!D:D is the short list and you want to know which in 'Report Stats'!A:A does not match.
Code:
Sub donotMatch()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long, c As Range
Set sh1 = Sheets("2014 Q3")
Set sh2 = Sheets("Report Stats")
lr = sh1.Cells(Rows.Count, 4).End(xlUp).Row
    For Each c In sh1.Range("D2:D" & lr)
        If Application.CountIf(sh2.Range("A:A"), c.Value) = 0 Then
            lst = lst & c.Value & ", "
        End If
    Next
MsgBox lst
End Sub

Reverse the sheet names if it is the other way around for most and least.
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,352
Members
449,080
Latest member
Armadillos

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