Reputation: 36307
I'm working with excel 2016. I have some unstructured data as in the screenshot. I would like to extract the zip code ( which should be the last 5 digit number in each cell ).
I'm new to excel . Do I need to install and use regex to extract the zip code(How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops)
or is there a more standard not vb related function/group of functions in excel that can do this?
Upvotes: 1
Views: 626
Reputation: 152585
If the zip code is always the second to last group delineated by commas:
=MID(A2,FIND("{{{",SUBSTITUTE(A2,",","{{{",LEN(A2)-LEN(SUBSTITUTE(A2,",",""))-1))+2,5)
Or if one has it FILTERXML:
=FILTERXML("<t><s>"&SUBSTITUTE(A2,",","</s><s>")&"</s></t>","//s[last()-1]")
Upvotes: 2