Count Postcodes within a sheet

TryingtoLearnExcel4

New Member
Joined
Aug 29, 2018
Messages
5
Hi

I’ve just registered on this site so apologises in advance if my post is incorrect in any way.

I need some help :

I have a list of postcodes for a particular county (wanted list)
I have another list of random postcodes from lots of different counties (general list)

I need to identify how many times postcodes from my wanted list occur in the general list.

The general list is approx 80000 records.

I’ve been reading around and pivot tables are mentioned a lot.

I’ve got very basic excel experience and don’t know much even about pivot tables. Can someone please please please walk me through this process I need to achieve my desired result?

Thanks in advance.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
.
Paste this in a Routine Module :

Code:
Option Explicit


Sub IsItThere()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long, c As Range, fn As Range
Dim i As Integer


Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Edit sheet name
i = 0




lr = sh1.Cells(Rows.Count, "A").End(xlUp).Row
    For Each c In Range("A2:A" & lr)
        Set fn = sh2.Range("A:A").Find(c.Value, , xlValues, xlWhole)
            If Not fn Is Nothing Then
                i = i + 1
                sh1.Range("D1").Value = i
            End If
    Next
End Sub

Download sample workbook : https://www.amazon.com/clouddrive/share/rcIQRQF8st41YNM7rtwmgmFRnt4uwMiHVcxKMZZpV6N

If you have your postal codes in Col A of Sheet 1 (Wanted List) and your General List in Col A of Sheet 2, the macro will display the total number of matches.
 
Upvote 0
Wow thanks a massive thank you for replying so quickly!

I’m not so clued on about how to do the routine module stuff but I will try it now and let you know how I get on within next couple of hours
 
Last edited by a moderator:
Upvote 0
.
Code:
=SUMPRODUCT(COUNTIF(Sheet1!A2:A30,Sheet2!A2:A30))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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