Discover Easy Formulas to Extract Text from Excel Cell

Need to extract specific parts of text from an Excel cell? This guide and practice spreadsheet will show you how, whether it’s an address, phone number, or part of a product description. We’ll explore straightforward techniques, including Excel formulas, to isolate your text and make your Excel data easier to manage.

What’s a Substring in Excel?

Let’s clarify some items before we have Excel extract text from string. First, many programming languages have dedicated substring functions. Microsoft Excel does not, although some developers have created 3rd party add-ons . So instead, we’ll rely on Text functions.

Drop-down list of Excel text functions.
A drop-down list of Excel Text functions

When we speak of a substring, we mean a part or subset of the Excel cell’s content. For example, if our cell contains the original string 1001 Drake Ave., any of these items could be a substring:

  • 1001
  • Drake Ave.
  • 100
  • rake

Typical Text String Mess

For this guide, I’ll use a spreadsheet with street names and numbers in the same cell. This format works fine if you’re creating a mailing label, as the post office relies on zip code sorting. But what if you need to do door-to-door canvassing? Maybe you have a group of volunteers and assign each one a neighborhood represented on a printed sheet.

If you open this list in Excel and sort on the Street column, you get a numerically sorted list. As you can see in the example below, the Drake Ave records are not together. Our volunteers would go all over town based on this sort.

Excel with single Street field sorted by number.
Street column sorted by Street Number.

Ideally, you want to sort the list so 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 original alphanumeric string. You can’t easily extract text using Excel Text to Columns wizard since we have repeating delimiters.

The first column reflects the street number substring, and the second is the street name substring. You can then sort the list based on the street name and number.

Microsoft 365 Extract Text Functions

One benefit to using Microsoft 365, is it has additional functionality. If you have this subscription, then I would start with TEXTBEFORE and TEXTAFTER. Both these functions make it easy to extract text from a cell. They are the easiest and don’t suffer from some flash fill quirkiness.

Use TEXTBEFORE to Grab Street Number

The TEXTBEFORE function is true to its name. It grabs the contents of a cell before a specific delimiter. In our case, we’ll be using the space between the street number and the street name.

  1. Open your spreadsheet or use the sample spreadsheet in the Resource section.
  2. In cell D1, type NBR.
  3. In cell E1, type STREET NAME
  4. In cell D2, type the following formula:
=TEXTBEFORE(C2, " ",1,1)
TEXTBEFORE function searching for first space.
TEXTBEFORE function to extract street number

With this formula, I’m asking Excel to extract the text before the space in cell C2. The first 1 represents the “instance number” of the delimiter. In my scenario, I want the first space. However, if I change the value to 2, the function would extract 1001 Drake because it would use the space between Drake and Ave. The second 1 in the formula indicates the match mode. The 1 is for case insensitive.

TEXTAFTER to Grab Remainder

You can think of TEXTAFTER as the compliment to TEXTBEFORE. The function works similarly except it extracts part of the text after your delimiter. In our scenario, we want to extract everything past the first space between the number and street name.

=TEXTAFTER(C2," ",1,1)

If you get confused with any of the parameters, you can always use the option of adding parameters using the Function Arguments dialog box. The dialog is nice since it provides context and highlights the result.

Building a Nested Extract Formula

For those that don’t have Microsoft 365,, we’ll nest some Excel functions such as LEFT and FIND. As we progress, we’ll add several sets of parentheses. By nested, I mean we’ll use one function (FIND) as an argument for another function, such as LEFT or RIGHT.

Using the FIND Function

Let’s start with =FIND(" ",C2). In plain text, our function syntax asks Excel to look in cell reference C2 for a single space represented by the “. ” I added a starting position of “1” in the picture below, but this is an optional parameter, and Excel starts at 1 by default. Excel found the blank space in position 5, which is shown in cell D2.

Using FIND to look for blank space.
Finding the blank space between the street number and street

I’ll remove the optional starting parameter of 1 to simplify the formula since Excel starts there anyway.

In this scenario, I used FIND, which is case-sensitive. Microsoft has a SEARCH function, which is case-insensitive.

Using the LEFT Function

Now, let’s add the LEFT function so that our formula reads =LEFT(C2,(FIND(" ",C2))). In this instance, we’re again using cell C2, but the LEFT function will grab the cell contents in C2 from the leftmost character in position 1 to where the Excel FIND function found the blank space.

Extract text from excel cell with full street address.
Finding street number within the C2 string

However, there is a minor issue. While you can’t see it, there is a trailing space in D2. Using the LEN function, we can see cell D2 has 5 characters. You may remember this handy function from our tutorial on how to check the character count in Excel.

Using LEN function to show trailing space.
LEN function counting trailing pace

The solution is to subtract 1 or use the TRIM function I referenced in how to separate names in Excel. For simplicity, I’ll use the -1. While the visual results are the same, the character count dropped by 1.

Adding -1 to formula to adjust for trailing space.
Trailing space removed

How to Extract Street Numbers Using LEFT Function

  1. Import your data into Microsoft Excel or use the sample spreadsheet in the Resource section.
  2. In cell D1, type Nbr.
  3. In cell E1, type Street Name
  4. In cell D2, type the following formula:
=LEFT(C2,(FIND(" ",C2)-1))
  1. Press Enter. The value 1001 should show in D2.

The next part involves copying this formula to the rest of the entries. First, we must reference the correct street cell and not use C2 for the remaining rows.

  1. Click cell D2 to select the beginning of our range.
  2. Move your mouse to the lower right corner.
Clicking fill handle to copy formula.
Copy the Excel formula down the column.
  1. Double-click the + cursor in the lower right. This will copy your formula down the column.

In column D, you should see the extracted street numbers.

How to Extract Street Names Using the RIGHT Function

Using the RIGHT function, we’ll create a similar nested formula to capture the street address. This time, we will grab the contents from the Street column to the right of the first space.

  1. In cell E2, type the following formula
=RIGHT(C2,LEN(C2)-FIND(" ",C2))
  1. Press Enter. E2 should show as Drake Ave.
  2. Click cell E2 to select the beginning of our range.
  3. Move your mouse to the lower right corner.
  4. Double-click the + cursor in the lower right. This will copy your formula down the column.

Columns D and E should contain the parsed contents from your original street address.

Your spreadsheet should look similar to the one below.

Excel with new number and street columns
Street Numbers and Names in new columns

The spreadsheet now has your split fields, but you may want clean up the formulas. For example you might want copy formula values in Excel to values.

These Excel formulas to extract text from cell are key skills for efficient data management. They can simplify the process of sorting and analyzing spreadsheet data. Utilizing these functions effectively can lead to more productive and organized data handling. While we focused on using a space as our delimiter, they can be modified to handle your scenarios. Now, it’s your turn to practice.

Excel Practice File