Excel Formula: Extract Street Number, City and Zip without Comma

unknownymous

Board Regular
Joined
Sep 19, 2017
Messages
249
Office Version
  1. 2016
Platform
  1. Windows
Hi Gurus,

Do you have any idea on how I can easily extract the details for a French address?

Example is: SAINT LEONARD 56200 ST MARTIN SUR OUST

SAINT LEONARD
56200​
ST MARTIN SUR OUST

Any help will be much appreciated. :)

Regards!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Is there any consistency or pattern?

Maybe?

Book32
ABCD
2SAINT LEONARD 56200 ST MARTIN SUR OUSTSAINT LEONARD 56200ST MARTIN SUR OUST
Sheet1
Cell Formulas
RangeFormula
B2B2=LEFT(A2,FIND(C2,A2)-1)
C2C2=TEXTJOIN("",TRUE,IFERROR((MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)*1),""))
D2D2=RIGHT(A2,LEN(A2)-FIND(C2,A2)-LEN(C2))
 
Last edited:
Upvote 0
For some reason, i'm getting an error in extracting the postal code.

1646282772789.png


Sometimes, there's a street number in the name. Example: 1 BOULEVARD DE LA VICTOIRE 49300 CHOLET

By the way, I'm using Excel 2016..
 
Upvote 0
That leading 1 will cause a problem with my code.

You need to post (using XL2BB) a variety of examples to see if this is possible.
 
Upvote 0
Book32
ABCDE
1helper
2SAINT LEONARD 56200 ST MARTIN SUR OUSTSAINT LEONARD 56200ST MARTIN SUR OUST56200
31 BOULEVARD DE LA VICTOIRE 49300 CHOLET1 BOULEVARD DE LA VICTOIRE 49300CHOLETBOULEVARD DE LA VICTOIRE 49300 CHOLET
Sheet1
Cell Formulas
RangeFormula
B2:B3B2=LEFT(A2,FIND(C2,A2)-1)
C2:C3C2=IF(ISERR(LEFT(E2,1)*1),TEXTJOIN("",TRUE,IFERROR((MID(E2,ROW(INDIRECT("1:"&LEN(E2))),1)*1),"")),E2)
D2:D3D2=RIGHT(A2,LEN(A2)-FIND(C2,A2)-LEN(C2))
E2:E3E2=IF(ISERR(LEFT(A2,1)*1),TEXTJOIN("",TRUE,IFERROR((MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)*1),"")),RIGHT(A2,LEN(A2)-FIND(" ",A2)))
 
Upvote 0
Hi,

May be these will work, based on 2 samples provided:

Book3.xlsx
ABCD
2SAINT LEONARD 56200 ST MARTIN SUR OUSTSAINT LEONARD56200ST MARTIN SUR OUST
31 BOULEVARD DE LA VICTOIRE 49300 CHOLET1 BOULEVARD DE LA VICTOIRE49300CHOLET
412345 SAINT LEONARD 00009 ST MARTIN12345 SAINT LEONARD00009ST MARTIN
Sheet1030
Cell Formulas
RangeFormula
B2:B4B2=TRIM(LEFT(A2,MIN(FIND({0,1,2,3,4}+{0;5},A2&1/17,FIND(" ",A2)))-1))
C2:C4C2=TRIM(LEFT(SUBSTITUTE(MID(A2,LEN(B2)+2,99)," ",REPT(" ",99)),99))
D2:D4D2=MID(A2,LEN(B2)+LEN(C2)+3,99)
 
Last edited:
Upvote 0
Hi,

May be these will work, based on 2 samples provided:

Book3.xlsx
ABCD
2SAINT LEONARD 56200 ST MARTIN SUR OUSTSAINT LEONARD56200ST MARTIN SUR OUST
31 BOULEVARD DE LA VICTOIRE 49300 CHOLET1 BOULEVARD DE LA VICTOIRE49300CHOLET
412345 SAINT LEONARD 00009 ST MARTIN12345 SAINT LEONARD00009ST MARTIN
Sheet1030
Cell Formulas
RangeFormula
B2:B4B2=TRIM(LEFT(A2,MIN(FIND({0,1,2,3,4}+{0;5},A2&1/17,FIND(" ",A2)))-1))
C2:C4C2=TRIM(LEFT(SUBSTITUTE(MID(A2,LEN(B2)+2,99)," ",REPT(" ",99)),99))
D2:D4D2=MID(A2,LEN(B2)+LEN(C2)+3,99)
This one is working.

Also, i have this one last sample of address format:
10 AVENUE DU 1ER DPG 57260 DIEUZE

The postal code is located at the most end of the address.

Appreciate your help. :)
 
Upvote 0

Forum statistics

Threads
1,215,404
Messages
6,124,715
Members
449,184
Latest member
COrmerod

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top