Remove text after first occurence of numbers

ausswe

Board Regular
Joined
Feb 19, 2013
Messages
56
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have a large dataset with street addresses (in column A) than can look like this:
  • Streetname 15 (this is the street name and number of the street)
  • Streetname 16 A (street name + number + entrance)
  • Streetname 17 C Apt 1001 (streetname + number + entrance + apartement number)
  • Streetname 18 Apt 1021 (streetname + number + apartement number)
I need to match these from another dataset where the streetnames are entered only as "Streetname 15" (with no entrance or apartement number) so I'm trying to find a formula that will remove any text after the first occurence of a numeric value (but keep the number) so that it become:
  • Streetname 15
  • Streetname 16
  • Streetname 17
  • Streetname 18
I have tried a few different ways but haven't found one that produces the result.

Any suggestions (and hope that makes sense)?
 
Hello,

You can use a REGEX like so

Excel Formula:
=REGEXEXTRACT(A1, "^([A-Za-z\s]+)\s(\d+)")
 
Upvote 0
Another RexEx suggestion in B2 with comparisons of the previous suggestions in cols C & D.

25 03 19.xlsm
ABCD
1Post 4Post 3Post 2
2Smith Street 15 (this is the street name and number of the street)Smith Street 15Smith Street 15Smith Street
3Broadway 16 A (street name + number + entrance)Broadway 16Broadway 16Broadway 16
4Lower Hill Lane 17 C Apt 1001 (streetname + number + entrance + apartement number)Lower Hill Lane 17Lower Hill Lane 17Lower Hill
5Box-Hill Parade 18 Apt 1021 (streetname + number + apartement number)Box-Hill Parade 18#N/ABox-Hill Parade
RegEx
Cell Formulas
RangeFormula
B2:B5B2=REGEXEXTRACT(A2:A5, "^\D*\d+")
D2:D5D2=LET(a,A2:A5,b,FIND(" ",a,FIND(" ",a)+1),z,LEFT(a,b),z)
C2:C5C2=REGEXEXTRACT(A2, "^([A-Za-z\s]+)\s(\d+)")
Dynamic array formulas.
 
Upvote 0
.. if you do not yet have the REGEX functions then you could try this

25 03 19.xlsm
AB
1
2Smith Street 15 (this is the street name and number of the street)Smith Street 15
3Broadway 16 A (street name + number + entrance)Broadway 16
4Lower Hill Lane 17 C Apt 1001 (streetname + number + entrance + apartement number)Lower Hill Lane 17
5Box-Hill Parade 18 Apt 1021 (streetname + number + apartement number)Box-Hill Parade 18
Extract
Cell Formulas
RangeFormula
B2:B5B2=LET(s,SEQUENCE(10)-1,LEFT(A2,FIND(" ",A2,MIN(FIND(s,A2&s)))-1))
 
Upvote 0
Thanks guys!
I wasn't able to use regexextract apparently but the formula
Excel Formula:
LET(a,A2:A5,b,FIND(" ",a,FIND(" ",a)+1),z,LEFT(a,b),z)
worked!
 
Upvote 0
Please use this corrected formula, because previous formula will have a unwanted space at the end.
Excel Formula:
=LET(a,A2:A5,b,FIND(" ",a,FIND(" ",a)+1)-1,LEFT(a,b))
 
Upvote 0
I wasn't able to use regexextract apparently but the formula
Excel Formula:
LET(a,A2:A5,b,FIND(" ",a,FIND(" ",a)+1),z,LEFT(a,b),z)
worked!
If that formula (or the post #7 correction which removes the trailing space character) works for you then there must always only be one word before the first numbers. If that is the case then you could use this much simpler formula to extract the results.

ausswe.xlsm
AB
1
2Streetname 15 (this is the street name and number of the street)Streetname 15
3Streetname 16 A (street name + number + entrance)Streetname 16
4Streetname 17 C Apt 1001 (streetname + number + entrance + apartement number)Streetname 17
5Streetname 18 Apt 1021 (streetname + number + apartement number)Streetname 18
6
Extract (2)
Cell Formulas
RangeFormula
B2:B5B2=TEXTBEFORE(A2:A5," ",2)
Dynamic array formulas.
 
Upvote 0

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