How to strip down the postcode? I need to get district from it (1 Viewer)

phinix

Registered User.
Local time
Today, 17:42
Joined
Jun 17, 2010
Messages
130
Guys, I need to pull the district from postcode, so it would be various length string, from 2 to 4, but basically all up to first space.

How can I achieve this?
I know how to cut out last 3 characters using right function, but how to cut left side up to first space?
 

John Big Booty

AWF VIP
Local time
Tomorrow, 02:42
Joined
Aug 29, 2005
Messages
8,263
Have a look at the various string functions, particularly look at Instr() you should be able to use the results from that combined with Left() to return the result you are after.
 

phinix

Registered User.
Local time
Today, 17:42
Joined
Jun 17, 2010
Messages
130
Thanks, I just came up with solution!:)
First I use InStr to get position of space, then I use Left function to cut up to that space position, then I use Trim to cut out the space:)
Sweet!:)
 

phinix

Registered User.
Local time
Today, 17:42
Joined
Jun 17, 2010
Messages
130
Have a look at the various string functions, particularly look at Instr() you should be able to use the results from that combined with Left() to return the result you are after.


now I have a another problem - I got this district part, but I how can I get rid of digits in the district part?
For example some are G2, G32, HU21, etc. - How can I keep the letters and get rid of digits?
 

phinix

Registered User.
Local time
Today, 17:42
Joined
Jun 17, 2010
Messages
130
Try Replace() You will need to run your string through this ten times to remove the digits 0-9

Oh, I can't use replace, its 2 millions of rows, it stops every 10.000 rows and need to repeat it manually, which is impossible.

Is there anyother way to find string of digits and basically delete them?
 

Users who are viewing this thread

Top Bottom