Excel substring: how to extract text from cell

The tutorial shows how to use the Substring functions in Excel to extract text from a cell, get a substring before or after a specified character, find cells containing part of a string, and more.

Before we start discussing different techniques to manipulate substrings in Excel, let's just take a moment to define the term so that we can begin on the same page. So, what is a substring? Simply, it's part of a text entry. For example, if you type something like "AA-111" in a cell, you'd call it an alphanumeric string, and any part of the string, say "AA", would be a substring.

Although there is no such thing as Substring function in Excel, there exist three Text functions (LEFT, RIGHT, and MID) to extract a substring of a given length. Also, there are FIND and SEARCH functions to get a substring before or after a specific character. And, there are a handful of other functions to perform more complex operations such as extracting numbers from a string, replacing one substring with another, looking up partial text match, etc. Below you will find formula examples to do all this and a lot more.

How to extract substring of a certain length

Microsoft Excel provides three different functions to extract text of a specified length from a cell. Depending on where you want to start an extraction, use one of these formulas:

  • LEFT function - to extract a substring from the left.
  • RIGHT function - to extract text from the right.
  • MID function - to extract a substring from the middle of a text string, starting at the point you specify.

As is the case with other formulas, Excel substring functions are best to learn from an example, so let's look at a few ones.

The easiest way to convert text to numbers in Excel

And to replace characters, convert line breaks and accented chars
Convert text to numbers Read more

Make your text in Excel beautiful and accurate

8 tools to manage text data
Trim Spaces, Add Text, Change Case, Extract substrings and more Read more

Extract substring from start of string (LEFT)

To extract text from the left of a string, you use the Excel LEFT function:

LEFT(text, [num_chars])

Where text is the address of the cell containing the source string, and num_chars is the number of characters you want to extract.

For example, to get the first 4 characters from the beginning of a text string, use this formula:


LEFT formula to extract a substring from the start of a string

Get substring from end of string (RIGHT)

To get a substring from the right part of a text string, go with the Excel RIGHT function:

RIGHT(text, [num_chars])

For instance, to get the last 4 characters from the end of a string, use this formula:


RIGHT formula to extract a substring from the end of a string

Extract text from middle of string (MID)

If you are looking to extract a substring starting in the middle of a string, at the position you specify, then MID is the function you can rely on.

Compared to the other two Text functions, MID has a slightly different syntax:

MID(text, start_num, num_chars)

Aside from text (the original text string) and num_chars (the number of characters to extract), you also indicate start_num (the starting point).

In our sample data set, to get three characters from the middle of a string beginning with the 6th character, you use the following formula:


MID formula to extract text from the middle of a string

Tip. The output of the Right, Left and Mid formulas is always text, even when you are extracting a number from a text string. If you want to operate on the result as a number, then wrap your formula in the VALUE function like this: =VALUE(MID(A2,6,3))

Extract substring before or after a given character

As shown in the above examples, the Left, Right and Mid functions cope nicely with uniform strings. When you are dealing with text strings of variable length, more complex manipulations shall be needed.

Note. In all of the below examples, we will be using the case-insensitive SEARCH function to get the position of a character. If you want a case-sensitive formula, use the FIND function instead.

How to extract text before a specific character

To get a substring preceding a given character, two things are to be done: first, you determine the position of the character of interest, and then you pull all characters before it. More precisely, you use the SEARCH function to find the position of the character, and subtract 1 from the result, because you don't want to include the character itself in the output. And then, you send the returned number directly to the num_chars argument of the LEFT function:

LEFT(cell, SEARCH("char", cell)-1)

For example, to extract a substring before the hyphen character (-) from cell A2, use this formula:

=LEFT(A2, SEARCH("-",A2)-1)

No matter how many characters your Excel string contains, the formula only extracts text before the first hyphen:
Extracting text before a specific character

How to extract text after character

To get text following a specific character, you use slightly different approach: get the position of the character with either SEARCH or FIND, subtract that number from the total string length returned by the LEN function, and extract that many characters from the end of the string.

RIGHT(cell,LEN(cell)-SEARCH("char", cell))

In our example, we'd use the following formula to extract a substring after the first hyphen:


Extracting text after a specific character

How to extract text between two instances of a character

To get a substring between two occurrences of a certain character, use the following generic formula:

MID(cell, SEARCH("char", cell)+1, SEARCH ("char", cell, SEARCH ("char", cell)+1) - SEARCH ("char", cell)-1)

The first two arguments of this MID formula are crystal clear:

Text is the cell containing the original text string.

Start_num (starting point) - a simple SEARCH formula returns the position of the desired character, to which you add 1 because you want to start extraction with the next character.

Num_chars (number of chars to extract) is the trickiest part:

  • First, you work out the position of the second occurrence of the character by nesting one Search function within another.
  • After that, you subtract the position of the 1st occurrence from the position of the 2nd occurrence, and subtract 1 from the result since you don't want to include the delimiter character in the resulting substring.

For example, to extract text surrounded by two hyphens, you'd use this formula:

=MID(A2, SEARCH("-",A2) + 1, SEARCH("-",A2,SEARCH("-",A2)+1) - SEARCH("-",A2) - 1)

The screenshot below shows the result:
Extracting text between two hyphens

If you are looking to extract text between 2nd and 3rd or 3nd and 4th occurrences of the same character, you can use a more compact SEARCH SUBSTITUTE combination to get the character's position, as explained in How to find Nth occurrence of a character in a string:

FIND(CHAR(1),SUBSTITUTE(cell,character,CHAR(1),Nth occurrence))

In our case, we could extract a substring between the 2nd and 3rd hyphens with the following formula:


Extracting a substring between the 2nd and 3rd hyphens

How to find substring in Excel

In situations when you don't want to extract a substring and only want to find cells containing it, you use the SEARCH or FIND function as shown in the above examples, but perform the search within the ISNUMBER function. If a cell contains the substring, the Search function returns the position of the first character, and as long as ISNUMBER gets any number, it returns TRUE. If the substring is not found, the search results in an error, forcing ISNUMBER to return FALSE.

ISNUMBER(SEARCH("substring", cell))

Supposing, you have a list of British postcodes in column A and you want to find those that contain the substring "1ZZ". To have it done, use this formula:


The results will look something similar to this:
Finding cells that contain a specific substring

If you'd like return your own message instead of the logical values of TRUE and FALSE, nest the above formula into the IF function:

=IF(ISNUMBER(SEARCH("1zz", A2)), "Yes", "")

If a cell contains the substring, the formula returns "Yes", an empty string ("") otherwise:
Formula to identify cells that contain a certain substring

As you may remember, the Excel SEARCH function is case-insensitive, so you use it when the character case does not matter. To get your formula to distinguish the uppercase and lowercase characters, opt for the case-sensitive FIND function.

For more information on how to find text and numbers in Excel, please see If cell contains formula examples.

How to extract text from cell with Ultimate Suite for Excel

As you have just seen, Microsoft Excel provides an array of different functions to work with text strings. In case you are unsure which function is best suited for your needs, commit the job to our Ultimate Suite for Excel. With these tools in your Excel's arsenal, you just go to Ablebits Data tab > Text group, and click Extract:
Extract Text tool in Excel

Now, you select the source cells, and whatever complex strings they contain, a substring extraction boils down to these two simple actions:

  1. Specify how many characters you want to get from the start, end or middle of the string; or choose to extract all text before or after a given character.
  2. Click Insert Results. Done!

For example, to pull the domain names from the list of email addresses, you select the All after text radio button and type @ in the box next to it. To extract the user names, you select the All before text radio button, as shown in the screenshot below.
Define the substring you want to extract.

And you will get the following results in a moment:
Parts of email addresses are extracted in separate columns.

Apart from speed and simplicity, the Extract Text tool has extra value - it will help you learn Excel formulas in general and substring functions in particular. How? By selecting the Insert as formula checkbox at the bottom of the pane, you ensure that the results are output as formulas, not values.

In this example, if you select cells B2 and C2, you will see the following formulas, respectively:

  • To extract username:


  • To extract domain:

    =IFERROR(RIGHT(A2, LEN(A2)- SEARCH("@",A2) - LEN("@") + 1),"")

How much time would it take you to figure out these formulas on your own? ;)

Since the results are formulas, the extracted substrings will update automatically as soon as any changes are made to the original strings. When new entries are added to your data set, you can copy the formulas to other cells as usual, without having to run the Extract Text tool anew.

If you are curious to try this as well as many other useful features included with Ultimate Suite for Excel, you are welcome to download evaluation version. If you like the tools, you can get a license, at a very special price:

Get Promo Code for Ultimate Suite - exclusive offer for our blog readers!

More formulas for substrings in Excel

In this tutorial, we have demonstrated some classic Excel formulas to extract text from string. As you understand, there can be almost infinite variations of these basic scenarios. Below you will find a few more formula examples where the Text functions come in handy.

Available downloads

Excel substring functions - practice workbook (.xlsx file)
Ultimate Suite - trial version (.zip file)

125 responses to "Excel substring: how to extract text from cell"

  1. Steven says:

    Nice primer, however, extracting a number from a string leaves me with another string. When I convert these strings to numbers via format I can't operate on them as numbers, they are still strings?

    • Hi Steven,

      Right, whenever you use a Text function (Right, Left, Mid) to extract something, the output is always text. In case of extracting a number from a string, the result is a numeric substring, which in terms of Excel is also text, not number. To convert it to number, you can wrap your formula in the VALUE function. Here's an example in the simplest form:


      And thank you for a smart question! I've added this tip to the article.

  2. Hank says:

    When I download weekly the raw date to an excel spreadsheet I was looking for a way to extract the name from the name-and-initials/initials-and-number from the raw data. Your tip (Left(cell, Search("char",cell)-1) is excellent. Below are some fictitious names:
    Hofman, Todd (th81)
    Medemblik, Terry (tjm)
    Williams, Mark (mrw)
    Vanderzwaag, Ron (rvz)
    Linde, Tim (tl1074)
    Nijenhuis, Andy (andy)
    Verhey, Tim (tmv)
    Moesker, James (jm1181)
    Martin, Nevin (nwm)
    Swaving, Brad (bs776)

  3. Julia Leibbrand says:

    "Prescriber: Mitchell CNM H Becky

    Patient: Patient Name

    Medication: FE TABS 325 (65 FE) MG ORAL TABLET DELAYED RELEASE; Qty: 60 Refills: PRN

    Ordered: 29-Dec-2017@1130

    Signed/Transmitted: 29-Dec-17@1130

    Pharmacy: Access Family Care Pharmacy*
    530 South Maiden Lane
    Joplin, MO
    Ph: 4177827209
    Fax: 4177827727"

    Above is a text field in an excel spreadsheet. I need to make the medication in a field by itself.

    Can you tell me how to pull what is after Medication:?

    • Francisco Aguilar says:

      FE TABS 325 (65 FE) MG ORAL TABLET DELAYED RELEASE; Qty: 60 Refills: PRN
      I will assume all the strings are in the format "Medication; Qty"
      1) To extract the medication, or what's before the semicolon, use:
      =LEFT(String, SEARCH(";",String)-1)
      2) To extract the Qty (and what's after), use:

    • Basile Ruau says:

      I'm sure there may be a more efficient way but you can do the following:
      =MID(A1, SEARCH("Medication: ", A1) + 12,SEARCH(";", A1, SEARCH("Medication: ", A1)) - (SEARCH("Medication: ", A1)+12))
      Assuming your text is in A1.

  4. RK says:

    The search function you describe does not work at all.

  5. Vic says:

    Challenge: I need to extract a string between two other strings (a word and a character) within a cell, but those other strings may repeat inside the cell.

    For example - a scanning tool conducts 10 tests and returns a failure for one but includes all the Passes in the output. The test results are separated within each cell with *****

    multi-line cell example:

    Test: Endpoint
    Result: Pass
    Details: Endpoint Connected
    Test: Resolution
    Result: Fail
    Details: Unable to resolve FQDN
    Test: Port
    Result: Fail
    Details: Port 1234 does not respond

    First thought was re-organize the output using text to columns butfor whatever reason it doesn't work (even after replacing the ***** with a single char like ^ (I'm guessing it's thrown off by the carriage returns within the cell).

    So we're left with searching for some combination of Mid, Len, Search/Find but it's proving extremely difficult. It's easy to find the first instance of "Failed", but hard to then find the stopping point which has to be the very next ^ char after "Failed", while also then being able to repeat the extraction for any other Failed tests inside the cell.

    • Jeff says:

      Vic, do you still need a solution for this? Also curious to know what tool you use for getting the port data and how you get it into excel. Some functions/searches can be done as part of the import procedure that are much harder to do afterward. cheers

  6. pratik says:

    How to get first name from below name list

    aakash kumar, Arvind soni, Tejas Sawant

    I want to extract first name "Aaskash kumar"? How to do this? Kindly help me?

  7. Abraham says:

    wanting to understand how to implement Case statement in Excel 2010. I have more than 20 conditions to match and if else is not helping me out. also I have researched in the internet they have asked me to make use of Choose function witch do not work either. could you please help how I can overcome the problem. here is some sample code that I have come up with to resolve my issue.
    ( 2 * COUNT(FIND("ID",AR2))>0) +
    ( 4 * COUNT(FIND("CD",AR2))>0) +
    ( 8 * COUNT(FIND("DTE",AR2))>0) +
    ( 16 * COUNT(FIND("PH",AR2))>0) +
    ( 32 * COUNT(FIND("AMT",AR2))>0) +
    ( 64 * COUNT(FIND("PER",AR2))>0) +
    ( 128 * COUNT(FIND("TOT",AR2))>0) +
    ( 256 * COUNT(FIND("NME",AR2))>0) +
    ( 512 * COUNT(FIND("NUM ",AR2))>0) +
    ( 1024 * COUNT(FIND("DESC",AR2))>0) +
    ( 2048 * COUNT(FIND("TYPE",AR2))>0) +
    ( 4096 * COUNT(FIND("ADDR",AR2))>0) +
    ( 8192 * COUNT(FIND("EMAIL",AR2))>0) +
    ( 16384 * COUNT(FIND("RATE",AR2))>0) +
    ( 32768 * COUNT(FIND("PCT",AR2))>0) +
    ( 65536 * COUNT(FIND("NOTE",AR2))>0) +
    ( 131072 * COUNT(FIND("ZIP",AR2))>0) +
    ( 262144 * COUNT(FIND("STE",AR2))>0) +
    ( 524288 * COUNT(FIND("TITLE",AR2))>0) +
    ( 1048576 * COUNT(FIND("SUM",AR2))>0)

  8. Matt says:

    I have a string (05/21/201806:59:0511.311.311.711.3) and wanting to break the data up. I know I can do Left(), Mid() and Right() to get what I want. But what I am trying to find a way to copy/paste without the formula in the final cell. I will need to be able to copy the separated data into another spreadsheet. Is there a way to paste into another cell without the formula in it?

    • Doug says:

      If I understand your question correctly I would say you can right click choose Paste Special, then choose the Value button. No formulas, only values.

  9. Paul says:

    Thanks - I tested out the functions and learned something new. I can extract the JPN or GB from "Chatoyancy(JPN)" or Morgan's Mambo(GB) - BUT I really need to separate the text so I am left with "Chatoyancy" and "JPN", or "Morgan's Mambo" and "GB".

  10. Paul says:

    Regarding my previous post - I'm trying Text to Columns - awkward, but I think I got it.

  11. Bode says:

    SCPA-2F1ASO-PAC01-JB01-PA-100 How can i extract data between the 2nd and third hyphens to different cell and also the third and fourth unyo a differnt cell.

    Many thanks

    • Doug says:

      You can use the Text-to-Columns tool. It's under the Data tab. Just enter"-" as the delimiter.
      Or you can enter this into an empty cell and copy it across as many columns as needed. My test data was in A1, so you might want to change that address.
      You can also copy it down as many rows as needed.
      =TRIM(MID(SUBSTITUTE($A1,"-",REPT(" ",100)),(COLUMNS($A$1:A$1)-COLUMN($A$1))*100+1+SUMPRODUCT(LEN($A1:A1))-LEN($A1),100))

  12. julia says:

    how can i change format 243F160918D1 to {24, 3f, 16, 09, 18, d1}?

    • Doug says:

      Not sure how to format a cell to display the number in the manner you want, but here's a formula to add a comma after every other character.
      Where the original text is in A83:
      As you can see we start at the left of the text in A83 return the first two characters and then concatenate a comma. Then we use the MID function to concatenate the text in A83 beginning with the third character and return the next two characters and concatenate a comma.
      Continue with this same process until all characters have been added to the new string which contains a comma after every other character except the last one.
      You can change the cell addresses, the number of characters to skip and/or return and the inserted character to suit your needs.

  13. Sid says:

    I have a sheet with a list of docs (>500k), with their respective path. I want to extract the folder name from the path. Since, it has folders and sub-folders, the folder name doesnt come at the same position. The path is reported as "E:\abc\defg\...\xyz\". Basically, I'm looking to extract the text between the last two "\" i.e. "xyz".
    Thanks in advance

    • Doug says:

      Is it always the case that the information you want is in between the last two forward slashes?

      • Z says:

        I have the same question - yes the information I need is always between the last two “\”
        Can you suggest me a formula for this

        • Hello!
          If I understand your task correctly, the following formula should work for you:

          =MID(A1,SEARCH("@",SUBSTITUTE(A1,"\","@",LEN(A1) - LEN(SUBSTITUTE(A1,"\",""))-1),1)+1, LEN(A1)-SEARCH("@",SUBSTITUTE(A1,"\","@", LEN(A1)-LEN(SUBSTITUTE(A1,"\",""))-1),1)-1)

          I hope my advice will help you solve your task.

  14. Abdul Musawwir says:

    how can i seperate out cheque no in a seperate cell plz quide me. the data in cel is:
    Cell data
    Cash Withdrawal # 58989,CHQ
    00060706,AHSAN JADOON
    4240113035499 CHQ 00060706 DHA SHAHBAZ BRANCH,4240113035499

  15. Doug says:

    If the data is in H37 as one long string, enter this in an empty cell.
    It says, in H37 find the first "CHQ" go forward 4 characters which includes the "CHQ" and a space and return the next 8 characters.

  16. Emmylou says:

    Hi, how do I remove a decimal point for a number 04.80 to be converted to 0480?
    Thanks for your help.

    • Abdullahi Sule says:

      Hi Emmylou,
      How are you doing, i think you can use substitute function as =SUBSTITUTE(YourCell,".","".
      Thank you.

  17. Naomi says:

    I get reports where the name format isn't consistent -- some are FirstName LastName and others are LastName, FirstName.

    Can I use an IF statement combined with your extract formulas to create a single formula that extracts LastName from either format?

    Like this: IF(entry contains comma, LEFT formula, RIGHT formula)

    Would that work?

    And thanks for the great examples and explanations!

  18. Naomi says:

    Many thanks! The last name extract worked beautifully -- I'll try the first name next.

    Doug also sent me information -- I really appreciate everyone's help.

  19. Sumesh Kurichiveettil says:

    i have a string in one cell with length of 400 characters ( A1) . Is there a way i can extract first 150 characters in ( B1) one cell, next 150 in (C1)2nd cell and balance in 3rd (D1)



    • Doug says:

      The answer to your question is easy. My only question is why are there 400 characters in one cell?

      In B1 =LEFT(A1,150)
      In C1 =MID(A1,151,150)
      in D1 =RIGHT(A1,100)

  20. Saura Tripathy says:


    Need some help with extracting data from cell with multiple lines. For example below data is in a single cell. This is a report generated against multiple software with found version and existing version. There are thousands of cell with similar data with "Found: xxxxx". I would like to know a way to get ONLY "Found: xxxxx" data into another column. Would that be possible?

    Tested: C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll

    Found: 4.7.3130.0


    Fix: Install the appropriate patch from Microsoft or through Windows Update.

  21. Subbarao says:

    I have a data format like this "QA_CASE_1234_John_Smith" How do I extract John Smith in a separate cell without any underscore in John Smith name.

  22. Andrew says:

    If I have this string:


    How do I extract the 'ANDREW' alone?

    This is what I have:

    =MID(C2,SEARCH("v_",C2)+2,SEARCH("GORT",C2, SEARCH("v_",C2)+2) - SEARCH("GORT",C2)-1)

    It appears that "GORT" doesn't work. Is there any way to do this?

  23. Ashish Thapa says:

    I want to extract last 2 word before and after "-" in one formula
    Abc-ccc-ddd, here I need ccc-ddd

    Fff-hhh-kkk-yyy, here I need kkk-yyy

    Kkkk-hhh, here I need kkkk-hhh

  24. Marcus Gallagher says:

    Hello i'm trying to extract dimension from an item name column

    E.g. item names are all in a column and one would be "White fence post 80x80 1.8M" but another might be "RT1 35x150 treated decking 4.8MT"

    In these cases how do i pull out just those numbers?

  25. Joanne says:

    I am trying extract only the GB information from a cell in Excel. However in my report, there is an unknown number of times that the GB information will appear and I have at least 2000 lines to go through.

    A cell could look like this:
    0 GB (0% or 1.0:1), 9 GB (31% or 1.5:1)
    or like this:
    453 GB (29% or 1.4:1), 728.25 GB (33% or 1.5:1), 422.25 GB (33% or 1.5:1), 923.5 GB (42% or 1.7:1), 705.5 GB (33% or 1.5:1)

    I want to extract each occurrence of the GB amount (i.e. 0 GB, 9 GB from the first example above and 453 GB, 728.25 GB, 422.25 GB, 923.5 GB, 705.25 GB from the 2nd example above)

    The ultimate goal is to be able to add the GB amounts together for each cell and get a total. I tried splitting the text, but because some of the cells have so many occurrences of GB's it didn't seem like a good choice.

    Does anyone have any ideas?
    Thank you in advance,

  26. Vishal says:

    i want to extract name NEW SAHARA BEEJ BHANDAR-TIJARA from NEW SAHARA BEEJ BHANDAR-TIJARA-F C ABS (if sentence containing ABS) with the help of if condition.

    • Vishal,

      Assuming your data is in A1, the following formula will help:

      • Vishal says:

        Thanks.formula works.And i have one more problem.If two cell of consecutive rows contain names.One cell having e.g name NEW RAJ BEEJ BHANDAR-NASIK-F C ABS & other cell having name NEW RAJ BEEJ BHANDAR-NASIK.Here i want to extract name NEW RAJ BEEJ BHANDAR from first cell if it contain ABS and otherwise it will remains the same if it doesn't contain ABS

        • Vishal,

          for your second task, please try this one:
          =IFERROR(IF(SEARCH("*ABS*",A1)>0,LEFT(A1, SEARCH("-",A1)-1),A1),A1)

          Here are the articles for you to learn how these functions work:
          IF function
          SEARCH function

          • Vishal says:

            My problem is suppose if two consecutive rows contain names e.g 1st cell does contain name NEW RAJ BEEJ BHANDAR-NASIK-F C ABS and in 2 nd cell doescontain name NEW RAJ BEEJ BHANDAR-NASIK.Now i want to extract only the name NEW RAJ BEEJ BHANDAR-NASIK from name NEW RAJ BEEJ BHANDAR-NASIK-F C ABS (when cell contains ABS). Otherwise the name must remains the same as NEW RAJ BEEJ BHANDAR-NASIK (when it doesn't contain ABS)

  27. sandeep kelakr says:

    i need help to identify in single cell with colour as we have three different things
    5 Pkt -Tata Rallis Fungicide Captaf (Size=500 gm)- 309 -
    1 Unit PGR Induce G 500 ml Rs. 515
    1 Unit Humic Acid Roota 1 kg Rs. 850"

  28. Erin says:

    I am trying to extract all letter characters (to the right) following the numbers in the middle of each text line. For example, the first line, I would only need "BLUE CROSS BLU"

    ACH DEPOSIT BCBS INC 462275727 101000011824415 BLUE CROSS BLU
    ACH DEPOSIT HCCLAIMPMT 1932440070 031100200512323 AETNA A04
    ACH DEPOSIT HCCLAIMPMT 1932440070 031100204517462 WPS

    Any ideas on how I could do this?

  29. Rahul says:

    Hi I'm Rahul Actually I'm new Learner Excel Can You Help Me in Excel

  30. RFoley says:

    I need to extract the first 3 numbers, between the 2nd and 3rd dash. The number of characters between the dash can vary between 3 and 4.
    I purchased the suite and have also used the above formulas and can’t get it to work. It always extracts the complete string between the “-“. I must have it extract only the 1st 3 characters between the dashes.

  31. P Jayachandra says:

    If a cell contains variable numbers (0 to 6) if cell value is 1 instead of 1 it should display Sunday and so on. Please give me the solution in Microsoft excel.

  32. amin firnashl says:

    The text string is "47 Nelson Street Kettering Northamptonshire NN16 8QN" in Cell A2.
    Here I need the street(47 Nelson Street), Town(Kettering), county(Northamptonshire) and Code(NN16 8QN) in each separate cell of a row.
    How to do this? Give me the formula for each retrieval.
    Also, another string is "Ref. No: 19/00443/EPHMO   Status: Current Licence   Applicant Name: Mr Jack Oliver McLoughlin" in cell A3.
    I need only the ref no (19/00443/EPHMO) and the name (Mr Jack Oliver McLoughlin) in separate cells.
    Help me with these formulas.

  33. Brad Smith says:

    I am using the formula: =SUMIF(Laurie!$A:A,B2,Laurie!$E:$E) to try and get names of people from a separate worksheet tab (tab is named Laurie). But the cells in column E on the Laurie tab are not numbers but someones name. So basically if I put a number in column E cells on the Laurie tab it will show up correctly in my current worksheet tab.
    But any names or non-numbers in the column E cells show up as 0 in my main worksheet. I am guessing this is because I am using the SUM function so it is trying to sum up any number in each cell in column E.
    Anyone help for which function would be best to get the name (or words) form those cells in that column would be great.

  34. Nancy M says:

    Hello! I have the below and depending on the length of my I need to pull everything up until the second hyphen so:
    PRO85-2700-270S would become PRO85-2700
    SPRI87-4000-400S would become SPRI87-4000

    but then I have some strings with 3 hyphens and I only need to pull up to the 3 characters after the 2nd hyphen.
    SLAE01-7000-330-7009-11 would become SLAE01-7000-330

    I have a file with 7K+ rows so any helps would be AMAZING and greatly appreciated!!


  35. Kevin says:

    I need to extract following words in my cells, which dont have any specific character and at the same time the amount of 1st words are not same:
    I should separate BNB from a 1st line and USDT from the 2nd one. as you see, I cannot use Text-To-Columns as well.
    please help!

  36. Risheesh says:

    how can we pull numbers from any alphanumeric string using a formula.

  37. Indunil says:

    Thanks For your Gide to separate W1 from {W1_21} that is sheet name of EXCEL generate from command of {MID(CELL("filename",A29),FIND("]",CELL("filename",A29))+1,255}

  38. Ignacio says:

    Could you please help me to create a formula to obtain the information of the second and the third bracket:

    [Ignacio] Status changed from [one] to [Tweleve]
    [Carlos] Status changed from [hundred] to [five]

    Thanks for you help!

  39. Gabriel says:

    Everything I read from Svetlana Cheusheva is always clear, straight forward and fill with examples. Damn I wish I knew more about MS Excel like her :o)

    Thank you for your excellent postings

  40. Tanmoy says:

    I want to extract 200 from "200 Euro", "Euro 200", "Euro-200", "200 Euro - 500 Euro",
    all are in a column.

  41. Chris says:

    Hello all, really need your help guys!

    I have a series of columns, for example: Colummn with 3 digit numbers like 420, a column with a word and a number like "Nascar 2", and a column with just a word that says "Honda". I need to make a formula that would combine those 3 columns, but shorten them. So I would use the first number "420", the number from "Nascar 2" and the first letter from "Honda". The solution would be 420-2-H and I need to make a formula for that with the "-" sign in between. Help please!

    • mwmentor says:

      Hey there:
      I would contemplate a formula using a number of different methods:

      Step 1 is simple and that would just be: =(A1) (for example)
      The second step requires extracting a number from the string and a good reference to achieve this can be found here: https://www.ablebits.com/office-addins-blog/2017/11/22/excel-extract-number-from-string/
      The third and final step is simple: RIGHT(C1;1) (RIGHT(Cell-Ref;No's chars)

      Now that you have your formula sorted out, stitch them together using concatenate:
      Replacing Step-1 through Step-3 with your formula. The = sign is used once at the beginning of the formula.

      Cheers... -M

  42. mwmentor says:

    Hi there:
    I am struggling to understand something here. I have the following string "avro_67563908_289(000).csv" to which I apply the following formula: `=MID(A6;SEARCH("_";A6)+1;SEARCH("_";A6;SEARCH("(";A6)+1)-SEARCH("_";A6)-1), which results in a `#VALUE!` error. I have spent quite a bit of time trying to understand this, given that the following test formula works: `=MID(A6;SEARCH("_";A6)+1;SEARCH("(";A6)-SEARCH("_";A6)-1)` - it just starts from the first `_` and not the second which is what I want.
    Is there anything obvious that I am doing wrong... the field format is `General`.


  43. amy says:

    I need to know how to extract everything to the left of a string in a list where there is not the same number of characters on the left side or right side of the string in a column. For example, I need to extract everything to the left of " - Garage 1" and " - Store 2" and " - Building" So, I want to get: Supplies-Other, Repairs-Equip, Salaries-Staff. I'm sure this is pretty simple, but I can't figure it out. Thanks in advance for any help anyone can provide!

    Supplies-Other - Garage 1
    Repairs-Equip - Store 2
    Salaries-Staff - Building 3

  44. Ands says:

    Hi, what should be the formula if I want to extract text from the cell but the result doesn't match the character that I am looking for? the best scenario is as below:
    14933 - Cologne West
    15116 - Tador East
    12345 - Cologne East
    45678 - Tador South
    36789 - Sucat
    15674 - Alabang

    From the list, I want to extract only the text but with a condition that if it is not "Tador", just copy the location, otherwise just put "Tador". I have tried several formulas but to no avail.

    Hope you can help me out on this, many thanks in advance!

  45. P G MEENAKSHI says:

    I have a long text (which is a extraction of narration from accounting entries) which contains month and year like "salaries for the month of FEB 2018", "cheque number 123456 paid to Mr. Rajan towards salary for the month of Feb 2018". Now i want to extract the month and year alone. Can somebody help me.

  46. Sayan says:

    How to extract the texts between 3rd and 4th or in case (last - 1) texts between instances of a character

  47. Orsolya says:

    Hi, I have long texts in the excel cells and I would always need to extract only the Impacted country which differs from cell to cell (in the example below it would be India). Only the text before the country is constant "Impacted Country (For multiple countries select global) = "

    Can anybody help how can I do that?

    Text in 1 excel cell is for example as below:
    ---------------------- USER ENTERED DATA ----------------------
    Operating System = Windows 10
    Impacted Country (For multiple countries select global) = India
    Idoc Number: = (NOT ENTERED)
    GSAP Transaction Code: = (NOT ENTERED)
    EMCS Table = (NOT ENTERED)
    Document Number: e.g. BOL, Nom key, LRN# = (NOT ENTERED)
    EMCS Dashboard Status = (NOT ENTERED)
    Interface ID: = (NOT ENTERED)
    Load date/Time = (NOT ENTERED)

    Thank you for your help in advance!

  48. Ganesh says:

    How do I cut the specific content from a cell?

  49. Kushal Ashitkumar Parikh says:

    i want to extract only LHS or RHS from the text, how to do it
    i.e 1234 LHS WERT SERT
    1234 RHS WERT SDFR

  50. Lorena Castillo says:

    Thank you!

  51. MOIN says:

    Dear can somebody help me to extract Q amount from below string,
    LON AC YTO Q125 Q100 AC YMQ Q125 AC YYZ


  52. Bassem says:

    I'm trying to enter the date in one cell (01-Jan-2020) column A and want excel to split it into three columns B,C,D (day, month and year). could you please help me in formula

  53. Surabhi Kumar says:

    I want to extract the contents of all cells containing a certain substring delimited by a "," or ";".
    For example:
    Cell A1 contains "0", Cell B1 contains "index:1", Cell C1 contains "0", Cell D1 contains "index:2"
    I want to find all the cells that contain the word "index" and when found, to extract the full contents of the cell into one cell. In the above example, I am looking for a return value index:1,index:2.

    How can I do that?

  54. Avantika says:

    I just have to say Thank you so much for this article!

  55. Javier says:

    LEFT(cell, SEARCH("char", cell)-1) is wrong, its ; instead of ,

  56. Norma says:

    I am trying to figure out what formula I would need to use to extract a value from the middle of a string. The length of the value can change so I was looking for a function that allows me to look up between 2 different characters including a character that repeats. An example: What is the area of a 60 degree circle when the bending radius is 1/8 round to the nearest tenth.
    I want to extract the 1/8, what formula would I need to use

  57. Terry Man says:

    May I know how to extract 黃惠玲 from string "Wong Wai Ling (黃惠玲)" in cell A1?
    Thanks & Best Regards,

  58. Thirukumar says:

    Hi Anyone can help me out extract "AHU" from "LEGTAIFIYA TVS AHU-02-A-1M"

    • Hello!
      The information presented to you is not enough to give you advice.
      Need to determine if "AHU" appears in the text? Or do you need to extract text from some position?
      Please describe your problem in more detail. It’ll help me understand it better and find a solution for you. Thank you.

  59. Hari Rana says:

    I want to put first four alphabets in last in the same column.
    For Example want to change 4296HR55U to HR55U4296.
    Pls help.

  60. michael r. olson says:


    I have a column in column A that has movie names and release dates as one text string. How do separate the movie name from the long date? I've figured out how to extract when it's only the movie name and date together, but sometimes the movie synopsis follows the date in the same column. This is where it stumps me. To split the movie and the date, when it's only those two items, I have a column for each month, and have used =iferror(left(a2,find($f$1,a2)-1),"") where f1 is the heading for January, g2 for February, h3 for March and so on through December. This has successfully given me the movie name, but in the column i have for the date, I have this formula (=text, e2,"mmmm dd, yyyy"). When the synopsis follows the date, I'm left with the date followed by a paragraph of text in that column that I can't seem to get rid of.

    Thank you,


    • Hello!
      Unfortunately, without seeing your data it hard to give you advice.
      Please provide me with an example of the source data and the expected result.
      It’ll help me understand your request better and find a solution for you.

      • michael r. olson says:

        is there a way to upload a snippet of my worksheet so you can see it? In essence I have one column that I want to split the date from the text. The source column would be formatted like:
        Source Result Result
        Column A Column B Column C
        Movie nameJuly 22, 2020 Extraneous text Movie name July 22, 2020
        Movie nameAugust 8,2020 Movie name August 8, 2020
        Movie nameSeptember 4, 2020 Alphanumeric Movie name September 4, 2020
        Movie nameMay 1, 2021 Text text text text Movie name May 1, 2021

      • michael r. olson says:

        The formatting of my reply should look nothing like that. I want three columns. The first column is for example: The King's ManSeptember 18, 2020 As a collection of history's worst tyrants and criminals....

        The second column, I want to output just the movie name

        The third column I want to output only the date in long format. I don't want the text that follows the date in the source column kept at all. I want to strip that and toss it away.

  61. Richa says:

    How do I extract a specific character from a word?
    eg - if the word is wate%r, how do i extract "%" from it. So if there is a list of words of different length, and different placements of "%", I need one formula which will extract the "%" from it. Result should be "%" for all words.

  62. Monica De Castro says:

    Extremely useful website! Thanks for sharing.

  63. Gopal Sharma says:

    i didn't got what i am looking
    i wants to extract number from a string
    i have extracted text to columns
    my name is gopal sharma and i my mobile number is 0011223344)* with me
    your name is unknown and 0011223345) is your contact number
    number could be in any cell
    how could i extract if i have different numbers

    • Hello!
      To extract all numbers from text, use the formula

      =SUMPRODUCT(MID(0&A1, LARGE(INDEX(ISNUMBER(--MID(A1, ROW(INDIRECT("1:"&LEN(A1))), 1)) * ROW(INDIRECT("1:"&LEN(A1))), 0), ROW(INDIRECT("1:"&LEN(A1))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(A1)))/10)

      I hope my advice will help you solve your task.

  64. Kim Sd says:

    I am this string of text and would like to extract out the consultation remarks and when I tried using the MID function, I am unable to get the remarks. Possible to help? Thanks
    RegistrationId : NYHAE20200820, ConsultationRemark : Testing right side of LHR,CreatedBy : Scott_Reynolds, CreatedDate: 22/8/2020 12:59:31 PM,UpdatedBy : Scott_Reynolds, UpdatedDate: 22/8/2020 12:59:31 PM

  65. sophied says:

    Hello!! Please help:
    how can i make a formula that: from a text in a cell TO CHOOSE the 3rd to 5th string AND at the same time the same product NOT TO BE repeated in the column AND IF repeated then CHOOSE THE NEXT consonant (not a vowel) AND IF reapeted (given the above formula) THEN SUBSTITUDE with numbers in row 1,2,3 etc?? ?

  66. KRISHNA says:


    Hello All,

    I need to extract "CD8", please anyone able to help me on this?


  67. Priscilla says:


    I would like to extract the text AFTER the second hyphen eliminating the any space to show just the text (SS & Medicare tax) from the string below:

    5200 · Payroll Taxes:5260 · SS & Medicare tax

    Thanks in advance!

  68. Khan Nasir A says:

    How to get selected characters from string like below
    if i need to get 3rd & 5th say "RE" character from below how will i get

  69. Raj Pandit says:

    How can extract "Omkarbhai" bhai in first column and second column "Omkarben" how can extract ben,

    formula will apply one column. So it is possible or not. please share a logic please.

  70. Terra says:

    Is it possible to search for either of 2 substrings? I.e. if the text contains Orange OR Blue? I'm using this as a baseline to find one substring:

    =IF(ISNUMBER(SEARCH("1zz", A2)), "Yes", "")

    But, I need to see if another option exists as well. Either substring would be a positive result in my case.

  71. ragavendran says:

    I am not able to registration number from the sentence. I.e. AA01WW1111 TO ZZ11WW1111. Every time I am using mid and find formula with changing first two letters to pick registration numbers. Is there any alternate?

    • Hi,
      I’m sorry but your task is not entirely clear to me. Could you please describe it in more detail? What result do you want to get? What formula are you using?

      • ragavendran says:


        I am not able to get the 10 digit registration numbers from a sentence. Its contains various state registration numbers in each cell. At present, I am using the below formula.

        =mid(find,a1("AA",A1,1),10) to get AA10DE1234 from the sentence.

        • Hello!
          If your text is AA01WW1111 TO ZZ11WW1111, then you can extract both codes using the formula


          Hope this is what you need.

          • Ragavendran says:


            Thanks for your support. I wish to bring your notice that i want to find the codes between AA01AA0000 TO ZZ99ZZ0000. In this connection I have to fetch the first two characters which contains from AA to ZZ in a cell.

            I furnish below the table for your references.

            AA01DD1234 =MID(B3,FIND("AA",B3,1),10) AA01DD1234
            AB01DD1234 =MID(B4,FIND("AA",B4,1),10) #VALUE!
            AC01DD1234 =MID(B5,FIND("AA",B5,1),10) #VALUE!
            BC01DD1234 =MID(B6,FIND("AA",B6,1),10) #VALUE!
            DC03BD3214 =MID(B7,FIND("AA",B7,1),10) #VALUE!

            • Hello!
              If I understand your task correctly, the following formula should work for you:


              K1:K20 - range with the desired values - AA, ZZ, etc. There should be no empty cells.
              If there is anything else I can help you with, please let me know.

  72. Myrn Garash says:

    I'm working on a proyect that requieres to extract a 4 digits code from the raw data, I found it out using the formula: =MID(E2,FIND("-",E2)+2,4) and it worked perfectly for this template:
    Akbar, Bethany - w4x1 ^
    Acosta, Sandra - m9ii
    Slate, David - h3as
    Sheppard, Jilliam - J0LW ^

    The formula returns 4 digits code after "-" and " " (Space)... I got w4x1, m9ii, h3as, J0LW...
    But did not returned the correct code on othis case:
    Baker-Hudson, Alexis - j2mg

    The reason is because this template contains 2 "-" insted of one.
    What would you suggest? Is there any way I get get all of them right? I'll highly appreciate your help.

  73. Jeffrey says:

    I am working on simplifying my excel spreadsheet for work and I cannot seem to come up with the right function.
    My spreadsheet looks like a list of employees. I need to be able to take the first letter of the first name, the fourth letter of the first name then the first letter of the last name and the fourth letter of the last name and put it into another cell.
    Ex. if the name is Robert Michaelson, I need 'REMH' to be extracted from it. Does anyone know how to do this?

  74. Anwar zaib says:

    Dear All,

    please any one can help me to post some basic excel formulas.

    Thanks a lot

  75. Joe says:

    I have a state data... The template
    An Anambra state
    Be Benue
    FC Federal capital Territory
    Cr cross River state
    EJ Ekiti
    And I want to extract the state name only..
    Federal capital Territory
    Cross River
    How can I do this

  76. MANUEL LANZA says:

    Thank you,,,thank you,,,,thank you for your tips. By reading all pertinent examples (LEFT, RIGHT, MID and so on) on how to extract (or seek the presence of a substring in a cell ) was able to get rid of unwanted old data in my worksheet using the SEARCH function. The SEARCH function gave me a TRUE or FALSE value according to the match and then I sorted and got rid of all TRUE conditions. Kudos to You. You are the expert.

Post a comment

Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)