Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splitting Postcodes

Status
Not open for further replies.
Feb 16, 2006
4
GB
Hi

I want to return the letters at the start of a postcode only. for example b2 r12 should return b
b12 g23 should return b
ba1 h45 should return ba etc..
Can someone help me how to do this in a formula field
 
Try
Code:
If isnumeric(Mid({postcode}, 2, 1) 
then Left(({postcode}, 1)
else
If isnumeric(Mid({postcode}, 3, 1) 
then Left(({postcode}, 2)

You didn't give your Crystal version, but this would work with 8.5 and higher.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Thank you so much. That worked perfectly I have been struggling with it all day.

Thanks Again
 
Here's a limitless solution:

whileprintingrecords;
Stringvar MyInput:=trim({table.field});
Stringvar MyOutput:="";
numbervar counter;
For counter:= 1 to len(MyInput) do(
if not(isnumeric(mid(MyInput,counter,1))) then
MyOutput:=MyOutput+mid(MyInput,counter,1)
);
MyOutput

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top