Hi,
I have a series of zip codes that I need to parse the first set (District only), but they can be 3 or 4 strings (all separated by a space) so the Left formula is not working effectively. Is there a way that the formula left will be able to identify which ones should be 3 and which ones should be 4? I assume Regex/parsing could do that.
Here are some examples:
Input
EC1A 2FD
L9T 5G3
B93 0HL
Output
EC1A
L9T
B93
Thanks
Solved! Go to Solution.
Hi @Lucasvital ,
Since the delimiter is always a space, you can use the text to columns tool to achieve what you want.
I attached an example showing in Alteryx how to do it.
Let me know if that works for you.
Best,
Fernando Vizcaino
You might want to use a text to columns tool! Change the delimiter to \s and you'll get the result quickly.
cheers,
mark
Ps.
regex_replace([postal code],"(.*)\s.*",'$1')
that formula will do the parade for you.
cheers again,
mark
@Lucasvital @You can also use getword() as well.
GetWord(String, n): Returns the Nth (0-based) word in the String. Words are defined as a collection of characters separated by a space. 0-based index, means the first word is at the 0 position.
In your case, it would be getword([field1],0). This will grab the first digits till the space.