Need a formula/macro code

Bhugz

New Member
Joined
Jul 13, 2011
Messages
11
Hi guys and girls.

I need your help with coming up with a macro code/formula for spreadsheets that I work on.

The spreadsheets I work on contain addresses of subscribers eg:
3462768 HASTINGS 4122
3504288 LOWER HUTT 5011
3568930 NELSON 7010
3566770 PAHIATUA 4910
3374483 PALMERSTON NORTH 4440
3566639 PORIRUA 5022
3389927 WAIKANAE 5036
3396769 WANGANUI 4500
3402104 WANGANUI 4574
3391879 WELLINGTON 6011
3420838 WELLINGTON 6011
3422600 WELLINGTON 6012
3570097 WELLINGTON 6012
3445211 WELLINGTON 6022
3386860 WELLINGTON 6022

What I want to be able to do is automatically with the use of a macro code categorise the different cities and suburbs to one of 9 regional areas (Wellington, Hutt Valley, Porirua, Kapiti, Wairarapa, Manawatu, Taranaki, Hawkes Bay and Other).

How would I go about doing this? I know I would need to use if statements but i'm just not sure about how to do the macro code for this.


Thanks.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I guess you need to extract area into adjacent column, select your data with that column and sort it :)
 
Upvote 0
As I'll be working on multiple spreadsheets going through months of data that is not ideal as there will be thousands of lines
 
Upvote 0
But you have no other way to get them sorted 'cause areas are among other text.
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,572
Members
452,927
Latest member
whitfieldcraig

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