Split Text string at specific character

Learn how to split a text string at specific character in Excel! Apply the LEFT, RIGHT, LEN and FIND functions or use the TextLeft and the TextRight functions.

Formulas to split a text string

First, we’ll use the old-fashioned way and the generic formula:

=LEFT(cell_reference,FIND("specific_character",cell_reference)-1)

Explanation

If you want to split a text string at every single special character (underscore, question mark, space, etc.), we’ll use a formula.

The formula contains three regular excel functions. Using the LEFT, RIGHT, LEN, and FIND functions, we can split a text string if the cell contains various delimiters and a number section.

In today’s example, the formula looks like this:

=LEFT(A2,FIND("?",A2)-1)

If we want to split the text string and get the numbers to apply the formula:

=RIGHT(A7,LEN(A7)-FIND("?",A7))
formula to Split text string at specific character

How to evaluate the formula?

Examine the formula from the inside out! The first part of the formula

=FIND("?",A2)

uses the FIND function and locate the first question mark in cell A2.

=FIND("?",A2)-1

Because we have an extra character (?), we subtract 1, and we’ll get the text. In this case, the FIND function returns 5, and we need to split the first 4 characters.

Apply the LEFT function to extract the text in A2, starting from the left:

=LEFT(A2,FIND("?",A2)-1)

The result is: John

Tip: You can use another specific character, like “#”,” _”, or something else. You only need to replace the second parameter of the FIND function.

Let us see how to extract the numbers!

To split the numbers from the text string, we’ll use the RIGHT and the FIND function.

As we mentioned above the FIND locates the position of the question mark. After that, subtract this number from the total length of cell A2.

LEN(A7)-FIND("?",A7))
  • position of the question mark = 5
  • the total length of the text = 8
=RIGHT(A7,LEN(A7)-FIND("?",A7))
Let us see how to extract the numbers

This formula returns with 3 (8-5), so we have only one operation left. Now the RIGHT function will strip 3 characters from the right of the text.

=RIGHT(A7,3)

The result: 412

A better solution to split text string at a specific character

As usual, we can apply user-defined functions too.

A better solution to split text string at a specific character

The TextLeft and TextRight functions are useful if we want to split the text part and the number part of a string.

The syntax is simple:

=TextLeft(cell, delimiter)
=TextRight(cell, delimiter)

The first argument is the cell reference; the second is the delimiter. You can find these useful formulas in our free Excel add-in.

Related Formulas and resources