Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to parse Address Line 1 and Line 2 out of a field?

gc-804
7 - Meteor

I have an Excel data file that has address in one field with multiple lines for address line 1, address line 2, city/province/postal code, country. How to parse address line 1 and line 2 out of that address field and place each in a separate column but keep address line 2 blank if the record does not have an address line 2? Below are two made-up examples, one with and the other without the address line 2. Appreciate any help you could provide. Thank you!

 

NameAddress
Jane Doe25 Mary Glover Avenue
Markham, ON L8C 3B4
Canada
John Smith1900 King's Park Avenue
Unit 366
Toronto, ON M2R 1R9
Canada
 

 

3 REPLIES 3
CharlieS
17 - Castor
17 - Castor

Hi @gc-804 

 

In the example image above, the fact that the different parts of the address are on different lines means that there are "newline" characters in there that can be used to parse it apart. Try using a Text To Columns tool with the delimiter set to "\n" to see how that field can be split up.

 

I've attached an example to show how this can be done. I also included a few more tools to give an example of how you could use the contents of each field to determine what address part it could be and transform the data into address fields for geocoding. 

 

20200311-AddressNewline.PNG

gc-804
7 - Meteor

Hello @CharlieS,

Thank you for the quick reply! I tried using (.+)\n(.+) in Regular Expression in the attempt to just get the address line 1 and 2. It successfully parsed address line 1, but then address line 2 has all the data for country. So, I tried (.+)\n(.+)\n(.+)\n(.+) to break the address into 4 columns. Now records that have address line 2 have all been correctly parsed. However, records that don't have address line 2 returned only Nulls in the parsing results.  I am new to RegEx and would appreciate any help you or anyone could provide on getting the parsing results for both records with/without address line 2. Thank you!

gc-804
7 - Meteor

Hi @CharlieS,

Please ignore my last message as I did not see the last part of your response before I sent. Thank you so much for your help!! That's exactly what I need.

Labels