Irfan Sharif

A substring refers to a smaller string located within a larger string. Specifically, it is a string of characters at the left, right, or middle of the data. To extract an Excel substring, we can use some text-based standard formulas with fixed and variable length. We can also use some non-formula-based techniques. 

But let’s go back to the basics.

We store different types of data in cells in Excel. This data can be a number, text, date, or something else like a URL. The data itself is called string. A substring is a part of the overall data string. 

string and substring components

Excel Substring Functions

If you’re ever asked about an Excel substring function during an Excel interview, it’s a trick question; there isn’t one. But though there are no specific substring functions in Excel, there are still ways to extract a substring from a larger string of data. 

If we have to extract a left, right, or middle substring from a longer string of data, especially where there are thousands of records, we can use LEFT, RIGHT, and MID functions of Excel. But this is only the beginning. Combining these functions with LEN and FIND functions, we can apply almost any kind of intelligence and extract any data that we need. We can also use tools such as Flash Fill, Find and Replace, and Text to Columns.

Microsoft Excel Beginner to Advanced w/ Data Analysis 101

Last Updated September 2023

  • 77 lectures
  • All Levels
4.7 (4,326)

Microsoft Excel A to Z with Excel Data Analysis, & Excel Dashboards. A complete MS Excel Beginner to Advanced Course! | By Irfan Sharif ACA ACCA, ITAAI Education

Explore Course

Let’s start with the most basic Excel substring functions.


If you need to extract a specific number of characters from the left side of a string, this is the function for you. 

All you need to input in this formula is the cell name that contains the string and the number of characters that you want to extract. 

Left function excel


If you need to extract a specific number of characters from the right of a string, the function you want is RIGHT. Again, all you need to input in this formula is the cell name that contains the string and the number of characters that you want to extract. 

Right function Excel


If you need to extract a substring from the middle, use the MID function in Excel. It requires you to input the cell name that contains the string, the character number from which you need the data, and the number of characters that you need to extract.

Mid function Excel

Did you notice that in each of the above formulas, we specified a specific number of digits that we need to extract? This is called hardcoding a number. Hardcoding can only bring the right answer if the string has the same length in each row, and so, we only need to extract the same number of characters in each row.

But that is not always the case, and we will usually need to extract dynamic characters from the string.  

Using the LEFT Function With a Dynamic Character Count

The LEFT function requires you to enter the number of characters from the left that you want to extract. However, often we need to extract data before a specific character like a space, period, comma, or @ sign. 

To extract a variable length Excel substring before a specific character, we can combine FIND function with LEFT function.

What is the FIND function? This function finds a specific character in the string and returns the number at which this character is located. 

So, to extract the substring of dynamic length from the left of the string, we need to use the LEFT function, and in the place of number of characters, we need to use FIND function.

= LEFT(Cell, FIND(“Character”, Cell)-1)

We have to do -1 as we do not want to bring in that special character

Left and find function Excel

Using the RIGHT Function With a Dynamic Character Count

To calculate the dynamic length from the right, we first need to calculate the total length using the LEN function, and then deduct the length of text before the specific character (that we calculate with the FIND function). This leaves us with a number of characters in the substring, which is on the right of the special character.

So, to extract a substring using the RIGHT function, we need to use the RIGHT function and then, in the place of the number of characters, we need to use (LEN-FIND).

Right and find function Excel

Finding MID Between Special Characters

MID functions allow us to enter the character number from which our new substring should start and at which it should end. To pick the data between two special characters, we need to calculate the character number of the special characters. We can do this with the FIND function, though that is a little circuitous.

To count the characters up to the first special character, simply use the FIND function to calculate the character number. Assuming the special character is left parenthesis, or “(“, it would look like this:

=FIND(“(“, cell)+1

+1 here makes sure we do not bring back the ( sign.

To count the characters up to the second special character, use the FIND function to count the character number of the second character. Here, we need to deduct the count of the first special character so that only middle characters are returned.

Assuming the second special character is “)”, and the first special character “(“, it would look like the following:

= ((FIND(“)”, cell) – 1 ) – FIND(“(“, cell))
Mid and find function Excel

So you can see that we can almost extract any kind of substring using the LEFT, RIGHT, and MID functions. But that’s not all! Here are some more workarounds that let you extract substrings; they are a bit lengthy to use, but these are formula free and do the job. They are “flash fill” and “text to columns.”

Extracting Excel Substring With Text to Columns

If we have to extract a substring before a special character, using the ‘Text to Columns’ option in Excel in a very easy and no-formula way. Let’s discuss this with the help of an example.

Let’s say you have to extract names from the email address. We can say that anything before the @ sign is the name. So, to extract the names from the email addresses, just select the column that contains the email addresses and then navigate to Formula Bar > Data tab > Text to Columns.

Text to columns in Excel

Once you click there, the following screen will appear. Select Delimited and click on Next.

Text to columns delimited

If your special character is a comma, a period, or a space, you can simply choose that by clicking the checkbox. For any other special character, you can click on ‘other’ and then insert the special character in the box.

Delimiters Excel

Now click Next, and then click Next again. This will split your data into two columns, the first column containing names and the second containing the rest of the data.

data split in two columns

Sometimes all the data will be imported into a single column even though it’s actually meant for separate columns. This usually happens when you extract data from a website or desktop software. 

In the below screenshot, the data that should be split over four columns has instead been imported into one column.

data imported

One possible option to extract substrings from this data is to use the “Text to Column” and “Fixed Width” functions. With this option, we can manually insert lines between the characters. 

Go to Formula Bar > Data > Text to Columns.

text to columns fixed width

Choose the ‘Fixed Width’ option in the first step and click Next.

fixed width excel

Now, click between the text to insert the lines. Each click will insert a new line, and this will split data into separate columns. To remove a line, just double-click on the line.

convert text to columns step 2

Now click Next and the Finish. It will take you back to your Excel workbook with your data now split into different columns.

data split into two columns

Of course, this is only possible where the length of the substring is the same in each row. However, as software databases are designed in a very systematic manner, this option will be useful in at least some of the cases.

Extract a Substring With Flash Fill

If you manually type a substring in the cell next to the string, Excel can observe the pattern and replicate the same for you in all the cells below. This feature is called ‘Flash Fill’.

Let’s continue with the same data we were using in the last example. If we need to extract substring starting with SO with three additional characters, we just need to type these characters in the next cell.

data sample Excel

Now click the cell B1 and go to: Formula Bar > Data > Flash Fill.

Excel flash fill

Click the Flash Fill, and Excel will fill all the cells below using the same criteria: character 6 to 10.

Let us give it one more try. Let’s write the product type appearing towards the end of the string.

excel data

Now click the Flash Fill, and the magic happens!

Excel data using flash fill

Extract a Substring With Find and Replace

Another quick, easy, and no-formula approach to extract the substring is to use the “Find and Replace” function to replace the unwanted string with nothing at all. 

Let’s say you have some unwanted characters in the string and you want to remove them. Select the column and press Ctrl + H on your keyboard. 

Alternatively, select the column and go to Formula Bar > Home > Find and Select > Replace.

Excel find and select, replace

The following pop-up should open.

Excel find and replace pop up

Now if we have to remove SO from the Order Number, we will just fill in ‘SO’ in the ‘Find what’ box and leave the ‘Replace with’ box empty. This will replace SO with nothing – that is, this will simply remove SO in each string in the entire column.

Excel find and replace confirmation

Using Excel Substring Functions

Extracting substrings from data in Excel is quite easy, both with formulas and without formulas. All you need to do is to practice LEFT, RIGHT, MID, LEN, and FIND functions. And if you are not formula-savvy, you can use Text to Columns, Flash Fill, and Find and Replace tools to extract a substring from a data string. 

Now that you know the substring extraction in detail, the next step should be to learn to clean the data. That begins with functions such as Excel Trim.

If you wish to learn Microsoft Excel from Beginner to Advanced level with all these techniques covering importing data into Excel, cleaning data, organizing data as per best practices, analyzing data and visualizing data, and building meaningful dashboards, consider a beginner Excel course or any other course on Microsoft Excel.

Page Last Updated: April 2022

Top courses in Microsoft Excel

Microsoft Excel - Excel from Beginner to Advanced 2024
Warrick Klimaytys
4.7 (12,373)
Python for Excel: Use xlwings for Data Science and Finance
Alexander Hagmann
4.8 (957)
Highest Rated
Microsoft Excel - Data Analytics Power Query and PivotTables
Kyle Pew, Office Newb
4.7 (1,506)
Microsoft Excel - Excel from Beginner to Advanced
Kyle Pew, Office Newb
4.7 (435,703)
Microsoft Excel: Data Analysis with Excel Pivot Tables
Maven Analytics, Chris Dutton
4.7 (61,702)
Microsoft Excel: Data Visualization, Excel Charts & Graphs
Maven Analytics, Chris Dutton
4.6 (47,403)
Data Analysis Essentials Using Excel
Symon He, Travis Chow
4.6 (12,675)
Microsoft Excel Pro Tips: Go from Beginner to Advanced Excel
Maven Analytics, Chris Dutton
4.6 (5,570)
Microsoft Excel Certification Exam Prep: MO-201 Excel Expert
Maven Analytics, Enrique Ruiz
4.6 (2,249)

More Microsoft Excel Courses

Microsoft Excel students also learn

Empower your team. Lead the industry.

Get a subscription to a library of online courses and digital learning tools for your organization with Udemy Business.

Request a demo

Courses by Irfan Sharif

Microsoft Excel Beginner to Advanced w/ Data Analysis 101
Irfan Sharif ACA ACCA, ITAAI Education
4.7 (4,326)
Financial Analysis & Financial Reporting w/ Advance Excel
Irfan Sharif ACA ACCA, ITAAI Education
4.7 (228)
Tableau Financial Reporting & Financial Analysis Masterclass
Irfan Sharif ACA ACCA, ITAAI Education
4.7 (186)
Microsoft Excel for Finance, Accounting & Financial Analysis
Irfan Sharif ACA ACCA, ITAAI Education
4.6 (1,681)
SQL for Financial Data Analysis & Reporting - Zero to Pro
Irfan Sharif ACA ACCA, ITAAI Education
4.3 (40)
Accounting & Bookkeeping Masterclass - Beginner to Advanced
Irfan Sharif ACA ACCA
4.6 (5,027)

Courses by Irfan Sharif ACA ACCA