Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1093221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:47:48+00:00 2026-05-16T23:47:48+00:00

I have an excel spreadsheet that contains entire addresses packed in a single cell

  • 0

I have an excel spreadsheet that contains entire addresses packed in a single cell without delimiters. The addresses look like this:

2701 NW 64TH TER MARGATE FL 33063-1703 
901 NE 8 ST HALLANDALE BEACH FL 33009-2626 
1840 DEWEY ST UNIT 305 HOLLYWOOD FL 33020 
3049 NE 4 AVE WILTON MANORS FL 33334-2047
650 NE 56 CT OAKLAND PARK FL 33334-3528 

So the first five cells in column A would contain the above addresses.

As you can see, some of the cities consist of two words but the state is always FL or NY. All I need to do is separate the address, city, state, and zip in their own columns. I’m hoping there’s a way to do this in VBD (Visual Basic for Developers) in excel. So I can put it into a macro.

I have an idea of how it can be done, but my VBD is limited:

stateArray = Split("FL, NY")
cityArray = Split("Fort Lauderdale","Sunrise","Oakland Park")

For example, another programming language you might do something like this:

var arrStates, arrCities
arrCities = ["Fort Lauderdale", "Sunrise", "Oakland Park"]
arrStates = ["FL", "NY"]

var findAddress = function(curCity, curState){
    for(var i=0; i < arrCities.length; i < arrStates.length; i--){

        (arrCities[i] == curCity) ? arrCities[i] = CurCity : arrCities[i] = null;
        (arrStates[i] == curState) ? arrStates[i] = curState : arrStates[i] = null;

    }   

    if(arrCities[i] >= 0){
        var city = arrCities[i];
    }

    if(arrStates[i] >= 0){
        var state = arrStates[i];
    }

    createTable(city, state);

}

var createTable = function(city, state){
    var tbl = document.createElement("Table");
    var newRow = document.createElement("tr");
    tbl.appendChild(newRow);
    cols = [city, state];

    for(var i=0; i < cols.length; i++){
        var newCol = document.createElement("td");
        newCol.innerText = cols[i];
        newRow.appendChild(newCol);
    }
}

Thanks for any response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:47:49+00:00Added an answer on May 16, 2026 at 11:47 pm

    It seems that if you have to type out all the cities, you might as well just split all the cells manually. It may be easier to identify all the street types and use that as a delimiter. Note the spaces around the strings in the array.

    Sub SplitAddresses()
    
        Dim vaStates As Variant
        Dim vaStreets As Variant
        Dim i As Long
        Dim rCell As Range
        Dim sAddress As String
        Dim sCity As String, sState As String
        Dim sZip As String
        Dim lStreetPos As Long, lStatePos As Long
    
        vaStates = Array(" FL ", " NY ")
        vaStreets = Array(" TER ", " ST ", " AVE ", " CT ")
    
        For Each rCell In Sheet1.Range("A1:A5").Cells
            sAddress = "": sCity = "": sZip = "": sState = ""
            For i = LBound(vaStreets) To UBound(vaStreets)
                lStreetPos = InStr(1, rCell.Value, vaStreets(i))
                If lStreetPos > 0 Then
                    sAddress = Trim(Left$(rCell.Value, lStreetPos + Len(vaStreets(i)) - 1))
                    Exit For
                End If
            Next i
    
            For i = LBound(vaStates) To UBound(vaStates)
                lStatePos = InStr(1, rCell.Value, vaStates(i))
                If lStatePos > 0 Then
                    sCity = Trim(Mid$(rCell.Value, Len(sAddress) + 1, lStatePos - Len(sAddress) - 1))
                    sState = Trim(Mid$(rCell.Value, lStatePos + 1, Len(vaStates(i)) - 1))
                    sZip = Trim(Mid$(rCell.Value, lStatePos + Len(vaStates(i)), Len(rCell.Value)))
                    Exit For
                End If
            Next i
    
            rCell.Offset(0, 1).Value = "'" & sAddress
            rCell.Offset(0, 2).Value = "'" & sCity
            rCell.Offset(0, 3).Value = "'" & sState
            rCell.Offset(0, 4).Value = "'" & sZip
    
        Next rCell
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, so I have an excel spreadsheet that contains data that I would like
I have an Excel spreadsheet that looks like: spreadsheet http://img186.imageshack.us/img186/6495/exelf.jpg I'd like to convert
I have an excel spreadsheet that is password-protected. I need to open this spreadsheet
I have an excel spreadsheet which contains addresses. I'm reading the data from the
I have a basic excel spreadsheet like this: A B C D etc.. 10%
I have an excel spreadsheet that has 8 connections. I would like to know
I have a cell that contains the placeholder $$value in the Excel sheet, the
I have a excel spreadsheet that contains a bunch of columns. My first column
I have an excel spreadsheet that contains some formulas to calculate ROI for an
I have an Excel Spreadsheet that contains all my data that I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.