Looping through postcodes

v1k

New Member
Joined
May 20, 2012
Messages
32
Hi,

I want to loop through a list of 40,000 postcodes to find any of them that begin with the prefix SE or SW. However, some of the postcodes are poorly formatted.

Raw data:



Desired result:



How would I do this ? Is it possible to use the ISNUMBER(MATCH()) function and then sort through the list to only show ones that give "TRUE"? This doesn't seem to work.

Thanks,

Vik
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi,
try the code
Code:
Sub aaa()
Dim i&
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
  If Not (Cells(i, 1).Value Like "SE*" Or Cells(i, 1).Value Like "SW*") Then Rows(i).Delete
Next i
End Sub
or similare one.

Best regards
 
Upvote 0
Or for a non VBA solution, you can try =OR(LEFT(A1,2)="SE",LEFT(A1,2)="SW")
 
Upvote 0

Forum statistics

Threads
1,203,605
Messages
6,056,258
Members
444,853
Latest member
sam69

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