Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Some programming languages have a substring function, but not Excel. However,
there are several text formulas that can achieve the desired result.
1001
Drake Ave.
100
rake
The Problem
Many membership databases or mailing lists are set up with defined fields for First
Name, Last Name, Street, City, State, and Zip. This format works fine if you’re
creating a mailing label as the post office relies on zip code sorting.
If you pull this type of list into Excel and sort on Street, you get a list that is
numerically sorted. As you can see in the example below, the Drake Ave records are
not together.
Excel with single Street field
Ideally, you would like to sort the list so all the Drake Ave entries are together. There
are several ways to do this in Excel, but one way is to create two columns from the
Street field.
The first column reflects the street number substring and the second the street name
substring. You can then resort the list based on the street name and street number.
If the addresses are simple, you could probably use the Text to Columns wizard.
In Step 4, our Excel formula will look at the original street value in cell C2
(1001 Drake Ave.) and extract the contents up to, but not including the first
space. The FIND function is used to find the blank.
The next part involves copying this formula to the rest of the entries. However,
we need to reference the correct street cell and not use C2 for the remaining
rows.
8. Double-click the + cursor in lower right. This will copy your formula down the column.
Columns D and E should contain the parsed contents from your original street
address.
After you convert the Nbr column, you probably want to change the format type to a
number.
1. Click column D.
2. Right-click and select Format cells...
3. On the Format Cells dialog, select Number.
4. Set Decimal places to 0.
5. Click OK.
Although our example is parsing one cell containing street information, you can use
the same steps to parse other types of entries. For example, Step 1 above is really
parsing everything but the first word because it is searching for a blank space. You
can alter the formula to find different values such as a comma.