# Filter The Column Of Postcodes Into The Postcode Defined Regions?

Jun 27, 2013

I have a list of post codes two letter starts by region. e.g.

inner london:

EC
WC
SW
W
NW
E
SE

In addition I have several very long lists of postcodes which I can obviously pull out the first two letters from using the Left function.

However I am wondering what is the best way to filter the column of postcodes into the postcode defined regions such as inner london nicely.

## Text Formula? Postcodes: Seperate The First Or First Two Text Characters From The Rest Of The Postcode

Feb 16, 2007

I am working on sales information which includes postcodes. What i need to do is seperate the first or first two text characters from the rest of the postcode. I have attached a small snipet of what i am working on. Currently i am using the =Left(A4,2) but this will give me in some case a numerical value aswell. For example E1 or G1 in the case of the sample attached. Is there a formula that exists where it will just return the text values in a cell and not numerical values.

## Macro To Filter Out Data For Five Regions

Jun 24, 2006

I've a workbook in which I run an excel macro to filter out data for five regions W1, W2, W3, W4, W5, the macro creates five sheets (w1, w2, w3, w4, w5) and places them in the same workbook along with the original master sheet called "west".

The data in all the sheets is layed out in an identical fashion except that the the number of rows in each sheet will differ depending on the number of records for each region in the master sheet "west".

I was looking for some vba coding to automatically add sum totals in two columns (I & J) for all the five region worksheets.

The first record always begins from row 4, in all the sheets.

so as an example W1 sheet could have a sum formula in I20 = Sum (I4:I8)
and in COl J as Sum(J4:J18). Row 19 is a blank row, and the intention is to leave a blank row just before placing the sum total in all the sheets.

W2 will have the same starting range but might differ in how many rows to sum .

And so on for the 4 remaining region worksheets in the workbook.

## Postcode In A Cell In Column A Appears In Column B

Jan 30, 2009

I want to see if a value in column A appears in any of the cells in Column B and to give the answer in column C.

I am trying to match postcodes, so I want to see if a postcode in a cell in column A appears in column B. I am aware the IF function will see if it appears in the cell in the ajoining row but I need to select the whole column dataset.

## Count If Column A Contains Defined Text And Column B Equals Defined Word

Mar 25, 2014

formula that would count the instances in Column C, where Column A contains "LH" or "RH" as part of the word, and column B equals "Either".

## Filter Pivot Field With Defined Cell Name?

Sep 17, 2012

I am trying to filter a pivot by one of its pivot field through label filter by referencing a cell with defined name within same workbook. Defined name is updated by selecting a value from list of names. As a result, I would like to have the pivot display results where pivot field contains the selected name.

Sub NameFilter()
'
' NameFilter Macro
'
Type:=xlCaptionContains, Value1:=[Name]
End Sub

## Automatically Naming Regions

Jun 26, 2007

I have a database where columns may be added and deleted quite frequently and I want to automatically name each column by it's heading, and make sure those cells keep their name if a new column is added.

## Vlookup/Macro: Regions In Sheet2, Average Of Next 6 Cells

Mar 2, 2010

I am trying to write a macro do the folowing

1. Vlookup Regions in Sheet2 (eg. AP-Asia/Pasific)
2. Check which row they are in
3. then take the average of next 6 cells (AVERAGE 1,310, 6,744 etc..)

## Getting Postcodes From Website Using VBA

May 19, 2014

I am desperately trying to get full postcode lists from two websites: [URL] .... and [URL] ........

The latter of the two is harder to get (I'm told) so it could also be available at: [URL] .... by selecting only the "Collect+" stores.

## Highlighting Same Postcodes In A Spreadsheet

Feb 26, 2009

I run a delivery business & work comes in bit by bit by postcode. I thus enter the postcodes into my spreadsheet.

Then when it comes time to process the work I'm wanting to be able to do something that will highlight all postcodes that match the same colour.

I posted this query on another forum & a helpful guy gave me the code below which worked a charm, but only for a while. Since then I have slightly tweaked the spreadsheet, taken a couple of fields off & added a couple. The code now hardly works or if it does will only do one column or row & not the complete spreadsheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim oDn As Integer, oAc As Integer, Dn As Range, oPC, nDn As Integer, nAc As Integer, Ac, c, p
Dim Rw1 As Range, Rw2 As Range, Rw3 As Range, Rw As Integer
If Target.Address(0, 0) = "A1" Then
Set Rw1 = Range(Range("E2"), Range("e" & Rows.Count).End(xlUp))
Set Rw2 = Range(Range("G2"), Range("G" & Rows.Count).End(xlUp))
Set Rw3 = Range(Range("I2"), Range("I" & Rows.Count).End(xlUp))
Rw = WorksheetFunction.Max(Rw1.Count, Rw2.Count, Rw3.Count)
oPC = Range("E2:I" & Rw + 1)

c = 2

For oAc = 1 To UBound(oPC, 2)
For oDn = 1 To UBound(oPC, 1)
If Not oAc Mod 2 = 0 Then
If c = 25 Then c = 2
c = c + 1

## UK Postcode Sorting

Nov 6, 2009

I've been assigned an assessment involving excel (2007), which involves me creating a small business system.

Part of this system involves a spreadsheet with a list of engineers and the postcode range that they are allocated to to fix callout problems.

What I would like to know, is if a callout request is made using a postcode, is it possible to automatically assign the engineer to the request?

Example, J Scott's work range is NE10 - NE19
If I entered the postcode NE12 7TD into the callout request form, is it possible to use formula or VB to assign J Scott's ID to the callout request?

All suggestions and help are greatly appreciated, I would request that solutions are kept as simple as possible as long as it's not much to ask for D:.

A possible solution i've thought of is making 2 fields in each of the engineer's rows, one being the lowest area range, and the other being the highest (e.g. J Scott's would be 10 and 19 respectivly) from there, I could possibly use formulae to assign the engineer's ID, and get his details using VLOOKUP.

## Delete Gaps In Cells (postcodes)

Jul 20, 2009

I have a load of postcodes over 8 different tabs, the problem is the format of the postcode is wrong. I basically need to delete the first gap of each cell to make the postcode valid -

DL 7 9
DL 8 1
DL 8 2
DL 8 4
DL 8 5
DL 9 3
DL 9 4
DL 10 4
DL 10 5
DL 10 6
DL 10 7
DL 11 7

You see I need to have it like DL7 9, or DL10 7, but i'm not sure how, I've attached the file so you can have a look.

## How To Detect When # Of Characters In One Column Does Not Match # Defined In Other Column

Feb 19, 2009

how to create a macro that:

- In each row, pops up a Warning Dialog Box if the amount of letters in column "J" doesn't match the # defined in column "B"?
- Preferably this would pop up the Dialog Box as soon as the error occurs (so it's always running)

Two Exceptions:
- Does not look at Rows 1 & 2
- Does not look at Rows where column B = 0 or null

## Insert A Space In A Postcode

Jan 5, 2010

I'm trying to find a formula that will put a space in the correct place in a British postcode.

I have a column I need to sort this way. Some of the postcodes already have the correct space and others don't.

British postcodes can be in several formats......

n = a letter
1 = a number

n11 1nn
n1 1nn
n1 1n
n1n 1n
n1n 1nn
n11n 1n
n11n 1nn
nn1 1nn
nn1 1n
nn11 1nn
nn11 1n

On a side note I need to make all the text uppercase. In the column some already have uppercase and others don't.

## Have Postcodes Flag Up When Entered Or Start Clicked

Dec 16, 2009

I have a spreadsheet with many many worksheets & on each of those worksheets many many postcodes.

I am looking for a way where I can have a list of postcode stored once somewhere (in excel, word or whatever) & then when we type postcodes into the Excel spreadsheet & click whatever to start the macro or run the code it will refer to where I have the postcodes saved & then highlight any that match on the worksheet page.

## Grouping Postcodes In A Way That Minimizes Sum Geographical Distance Between Them

Feb 13, 2014

I have a list of postcodes. Half of them belong to girls, and half of them belong to guys. I have the distances between each postcode in a matrix. I need to put these postcodes into groups of 6, where 3 of the postcodes belong to girls and 3 to guys, in a way that minimises the sum distance between all the houses in every group. I want each group to contain houses that are as close together as possible.

## Modifying Formula To Get First Part Of Postcode

Mar 7, 2012

I have this function that checks a postcode and returns a value using the first part of the postcode.

What i would like to know is how to modify the function so if there is only the first part of a postcode already entered, it looks for that.

At the moment sometimes i get #N/A even though i know that value is in there.

Code:

=INDEX(U\$4:U\$1068,LOOKUP(1068,MATCH(IF({0,1},LEFT(B338,FIND(" ",B338)-1),LEFT(B338,1+ISERR(MID(B338,2,1)+0))),T\$4:T\$1068,0)))

## Identify And Extract Postcode From Address?

Aug 25, 2012

Column D contains a complete address eg
60 Braugham Road, Wallasey, Merseyside CH46 1LP

I would like to be able to extract the postcode into column E, and then the address into columns F, G, H etc so that I can use the data for mailmerge docs. Is there a forumula or a macro that can be used to identify and extract the postcode? The postcode will usually be either one or two letters with one or two numbers, then a number and two letters. eg it might be as above or B6 9XF etc.

## Match Addresses Based On Postcode

Aug 30, 2007

I have a worksheet of customer data which includes full postcode / zip codes. I have a separate sheet where postcodes are listed. I would like to use the postcode list worksheet to find any address matches and then create a new worksheet of the filtered addresses (to include duplicates if found). Have attached a zip file of the spreadsheet data as an example.

## Excel 2003 :: Array Formula - Counting Postcodes?

Dec 21, 2011

I have these postcodes as example below but the array formula I was going to use won't work because, for example when I count everything with the Birmingham post code 'B' it counts every thing that contains the letter B which could also be in the post code BA1 3RL?

Excel 2003FGHIJKL2AB11 7TFWEB3ECRAB143AB12 3NFWEB3ECRAL54AB14 0QNWEB396FECRB1295AB15 4ANWEB34ECRBA86AB15 5LRWEB34ECRBB4Sheet1 (2)

## Sort Postcode List Alphabetically And Numerically

Aug 8, 2013

How can I sort the attached list both alphabetically and numerically. I have a list of UK postcode sectors which I am trying to sort alphabetically and numerically, the order should be eg AB1 0, AB10 1, G2 1, G20 1 but excel wont allow that sort order. There are three postcode formats

XX11 1
X1 1
X11 1

Where X an Y could be any letters in the alphabet and 1 could be any digit 0 to 9. Have attached a short list and formula in column B which would allow me to sort the list in column A which I can then apply to my full list.

Worksheet.xlsx‎

## Extracting Postcode Ranges To A Single Cell

Sep 24, 2009

I have a very large spread sheet of about 20,000 rows. I need to output to a cell postcode ranges based on the Zone. Not all the numbers in the postcode zones are consecutive.

For the example below, the output cell for the DWN range would display like this: 0800-0801, 0804, 0810-0813

Each output cell postal range must be specific to each zone.

Postcode Zone 0200 CBA 0200 CBA 0221 CBA 0800 DWN 0800 DWN 0801 DWN 0804 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0811 DWN 0812 DWN 0812 DWN 0813 DWN

Is there anyway to do this without manually doing it? I would like to tell you I've tried this and that but I've never done anything like this before so I really don't know where to start.

## Inconsistent Text Lookup - Return Postcodes From A List Of Descriptions

May 21, 2013

I'm trying to write a formula which will return postcodes from a list of descriptions which aren't consistent in their layout.

For example, I need this to happen

UB3 3NQ - APR13
SW3 5RQ - APR13
Jul 12 - apr13 accrual - ME9 4FW
Mar 12 - apr13 accural - SO14 7P2

Returned to another column as,

UB3 3NQ
SW3 5RQ
ME9 4FW
SO14 7P2

The issue I'm having is that the postcodes aren't in the same place in order to use LEFT, RIGHT or MID functions, and they aren't always proceeded or followed by dashes or spaces in the same way.

I need the returned postcodes to come back in a uniform way so that any duplicates are grouped by the relevant pivot table.

## Verify A Postcode Format That Starts With A Number Followed By One Or Two Letters

May 5, 2009

How would I verify a postcode format that starts with a number followed by one or two letters, space, number, letter, letter, if correct displays correct if incorrect displays incorrect

## Sum For Defined Column

Feb 17, 2010

regarding excel formula for summing of data in my list, please refer to my attached sample file, that allows me to define particular column when it ends? In this sample, cut-off should be B16 with criteria at B17 thus B18 should give Beta's Sum total ColB to ColG. I've tried to use "sumif" with "if" but I don't how to start constructing it. And how about for two criteria? (Sumproduct). Or any idea the ends up with same result.

## Autofilter.....but Only One Defined Column Not Many

Apr 4, 2007

I have a sheet with many labels arranged horizontally across the columns. I would like to Autofilter one of the columns but not see the filter drop downs for any of the other columns...

## VBA Ban, If Not Activated Defined Column

May 12, 2009

VBA ban, if not selected one of cells in defined column.
How to do it?

## Excel 2007 :: Ensure Cell Postcode Have 8 Characters (including Spaces)

Oct 8, 2012

Excel 2007.I have a list of postcodes (UK) which have different lengths of characters (including spaces) from 6-8, however our system seems to add additional spaces inbetween the postcode, so it could have upto 11/12 characters (inc spaces) Below is what could come out:

EH21 6PQ - 1 Space (8 Char)
EH12 9HG - 3 Spaces (10 Char)
E1 8DF - 3 Spaces (8 Char)
LL5 1GH - 2 Spaces (8 Char)
L5 1FG - 1 Space (6 Char)

What I need is a formula to ensure each postcode only has 8 characters by inserting spaces between if there's less than 8 char and trimming if there's more than 8 char

So from the above postcodes the desired results would be:

EH21 6PQ - 1 Space (8 Char) - This would be correct
EH12 9HG - 3 Spaces (10 Char) - Trim off 2 spaces from the middle
E1 8DF - 3 Spaces (8 Char) - This would be correct
LL5 1GH - 2 Spaces (8 Char) - This would be correct
L5 1FG - 1 Space (6 Char) - Insert 2 spaces in the middle

## Application Defined Or Object Defined Error When Creating A Pivot Table

Oct 1, 2009

I keep running into this error when I try to create a pivot table.

The debugger highlights the following line:

## Excel 2003 :: Stuck On User-defined Type Not Defined Error?

Oct 9, 2012

Trying to convert an Excel 2003 macro to work in Excel 2007.

The problem line is

Dim MyDataObject As DataObject

I suspect the problem is a Missing Reference, but I cannot figure out which one. I have the same ones (in 2007) as 2003 except for one which is not showing

Microsoft Forms 2.0 Object Library

Is this the one it needs? It is called something else in 2007?

The ones I do have ticked are

Visual Basic For Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.8 Library
Microsoft Scripting Runtime
Microsoft XML v2.6