Address has house number at end, sometimes - need split

ctackett6407

Board Regular
Joined
Mar 18, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hey folks had a question that I wanted a better solution then what I came up with, partially came up with.

The address Column starts in B2 (examples below)

I tried this in C column
=LEFT(B21332,LEN(B21332)-LEN(D21332)-1)

I tried this in D column
=TRIM(RIGHT(SUBSTITUTE(B21332," ",REPT(" ",LEN(B21332))),LEN(B21332)))

As you can see below my D column is giving me all kinds of results and I'm not sure how to grab the right data, I know I won't be able to fix them all but I'm wanting to not split the addresses where the Numbers are at the start of the line because those are the house numbers.

In the other columns I'm trying to grab the house number which these folks put at the end of the street address except .. not all the street addresses are ending in house numbers but contain LOT's etc..

I'm trying to figure out how to ignore the value if the house number is at the start.. and split the house number to it's own column and if anything comes after the house number it can go into it's own Unit Column,

I'm not sure how to accomplish this so seeking help from the more experienced.

1234 US HWY 10 SOUTH
A KIRKLY ST BEHIND 252
MAXWELL RD EXT (SHOP) 845
MAXWELL RD EXT 843 BARN
SEASHIP LN 333 TLR #11
ALFRED CIR 235 APT D-7
BRAVO LN 700 LOT 421,432
SOBERWICK AVE 3632
KITTEN CROW RD REMOTE
US HWY 252 N (BLK BLDG) 3462
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Don't know what you exactly want. Give some desired results for better solutions.
But you could try this UDF

VBA Code:
Function jec(cell As String) As Variant
 a = Split(Replace(cell, ",", ", "))(UBound(Split(Replace(cell, ",", ", "))))
 If IsNumeric(a) Then
    jec = a
 Else
    For Each it In Split(Split(cell, " ", 2)(1))
      If IsNumeric(it) Then jec = it: Exit Function
    Next
 End If
End Function
 
Upvote 0
@JEC Sorry, I couldn't figure out how to edit the original post for some reason.

The example is what I have and the goal is to split it

Original AddressAddress 1NumberUnit
1234 US HWY 10 SOUTH1234 US HWY 10 SOUTH
A KIRKLY ST BEHIND 252A KIRKLY ST BEHIND
252​
MAXWELL RD EXT (SHOP) 845MAXWELL RD EXT (SHOP)
845​
MAXWELL RD EXT 843 BARNMAXWELL RD EXT
843​
BARN
SEASHIP LN 333 TLR #11SEASHIP LN
333​
TLR #11
ALFRED CIR 235 APT D-7ALFRED CIR
235​
APT D-7
BRAVO LN 700 LOT 421,432BRAVO LN
700​
LOT 421,432
SOBERWICK AVE 3632SOBERWICK AVE
3632​
KITTEN CROW RD REMOTEKITTEN CROW RD REMOTE
US HWY 252 N (BLK BLDG) 3462US HWY 252 N (BLK BLDG)
3462​
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
This UDF spills it the right way at once

VBA Code:
Function jec(cell As String) As Variant
 Dim a As Variant, i As Long
 a = Split(cell)
 
 For i = UBound(a) To 0 Step -1
   If IsNumeric(a(0)) Then Exit For
   If IsNumeric(Replace(a(i), ",", "|")) Then
      a(i) = "~" & a(i) & "~"
      If i = UBound(a) Then Exit For
   End If
 Next
 jec = Split(Join(a), "~")
End Function

Excel Formula:
=jec(A2)
 
Upvote 0
Map1
ABCD
21234 US HWY 10 SOUTH1234 US HWY 10 SOUTH
3A KIRKLY ST BEHIND 252A KIRKLY ST BEHIND 252
4MAXWELL RD EXT (SHOP) 845MAXWELL RD EXT (SHOP) 845
5MAXWELL RD EXT 843 BARNMAXWELL RD EXT 843 BARN
6SEASHIP LN 333 TLR #11SEASHIP LN 333 TLR #11
7ALFRED CIR 235 APT D-7ALFRED CIR 235 APT D-7
8BRAVO LN 700 LOT 421,432BRAVO LN 700 LOT 421,432
9SOBERWICK AVE 3632SOBERWICK AVE 3632
10KITTEN CROW RD REMOTEKITTEN CROW RD REMOTE
11US HWY 252 N (BLK BLDG) 3462US HWY 252 N (BLK BLDG) 3462
Blad1
Cell Formulas
RangeFormula
B2,B10,B11:D11,B3:D9B2=jec(A2)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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