Skip to main content

How to extract string between two different characters in Excel?

Author: Sun Last Modified: 2024-07-26

When working with text data in Excel, you may often need to extract a substring that lies between two specific characters. For instance, extracting the text between parentheses, brackets, or any other delimiters can be crucial for data analysis and reporting. This tutorial will guide you through three effective methods to achieve this: using formulas, leveraging Kutools for Excel, and extracting text between identical characters.

screenshot of extracting substring between two characters

Extract part string between two different characters with formulas

If you prefer a hands-on approach, you can use Excel formulas to extract text between two distinct characters. Formulas like MID, FIND, and LEN can be combined to pinpoint the exact location of the characters and extract the desired substring.

Select a cell which you will place the result, type this formula, and press Enter key.

=MID(LEFT(A1,FIND(">",A1)-1),FIND("<",A1)+1,LEN(A1))
doc extract string between two characters 1

Note: A1 is the text cell, > and < are the two characters you want to extract string between.


Easily extract part of string between two characters with Kutools

Unlike formulas that require memorizing and complex syntax, Kutools simplifies the process into a few clicks. With its user-friendly interface, you can efficiently extract text between specified characters without the hassle of manual formula creation. This method not only saves time but also reduces the likelihood of errors, making it ideal for users who prefer a more intuitive approach to data manipulation.

After downloading and installing Kutools for Excel, select a cell to output the result, go to the Kutools tab and select Formula Helper > Formula Helper, then configure as follows:

  1. Check the Filter box and enter Extract to filter all formulas related to text extracting.
  2. Select Extract strings between specified text from the filtered list.
  3. Select the cell containing the substring you want to extract.
  4. In the Start char(s), type in the start character.
  5. In the End char(s), type in the end character.
  6. Click OK
    screenshot of extracting substring between two characters using Kutools
Result

Select the result cell and drag its Fill Handle down will get the rest of the results.

screenshot of extracting substring between two characters result
Note: To use this feature, you should have Kutools for Excel installed on your computer. Go to download Kutools for Excel to get a 30-day free trial with no limitations.

Extract part string between two same characters with formulas

Sometimes, you may need to extract text between two identical characters, such as quotes or parentheses. Using specific formulas, you can effectively target and extract substrings that are enclosed by the same characters. This approach is useful for standardizing data formats and preparing text for further analysis.

Select a cell which you will place the result, type this formula, and press Enter key.

=SUBSTITUTE(MID(SUBSTITUTE("/" & A3&REPT(" ",6),"/",REPT(",",255)),2*255,255),",","")
doc extract string between two characters 2

Note: A3 is the text cell, / is the character you want to extract between.


Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (35)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour,

je souhaite extraire de ce texte (USD) 934.915765 (30-11-2022) le numero 934.915765, ce que je souhaite c'est faire un extrait de tout ce qui est entre (USD) et (30-11-2022)
Sunny     cc
This comment was minimized by the moderator on the site
Hi, please try this formula:
=LEFT((MID(I1,FIND(" ",I1)+1,256)),FIND(" ",(MID(I1,FIND(" ",I1)+1,256)),1)-1)
I1 is the cell that you want to extract number.
This comment was minimized by the moderator on the site
Hi, try this formula please:
=IFERROR(MID(A1,FIND("CG",A1),11),IFERROR(MID(A1,FIND("CP",A1),11),IFERROR(MID(A1,FIND("CV",A1),11),IFERROR(MID(A1,FIND("CD",A1),11),IFERROR(MID(A1,FIND("CC",A1),11),MID(A1,FIND("CO",A1),11))))))

If there is no match string, it returns #VALUE! error.
This comment was minimized by the moderator on the site
Hello, can you please help me with extracting a code from a cell? The code is always 11 characters long and it can start with either CC, CP, CV, CO, CG or CD. If it helps, it also ends with a number always. The code does not have a fixed position, it can be in the beginning, middle or end.
I tried this formula =MID(A2,FIND("CP",A2),11) but, as you see, it only finds the ones starting with CP.

An example of what the cell might contain is:
Text text CG1234dh201 text 123 text

Thank you!
This comment was minimized by the moderator on the site
Hi, I have an issue which i am struggling to solve. So I have a number of answers and i want to separate into separate cells.

i.e. A: XYZ|B*: SDR|C: AQS|

I can separate but my issue is there loads of line with the asterisk moving to the correct answer for each question. How do i get my head around this?

I am currently using the below formula

=MID(A5,SEARCH("A:",cell ref)+2,SEARCH("|",A5)-SEARCH(":",cell ref)-1)
This comment was minimized by the moderator on the site
Hi, Mohannmed Faisal, from my understanding, your question is to extract XYZ, SDR and AQS separately into three cells. If so, please use formulas below separately:
=MID(A7,SEARCH("A:",A7)+3,3)
=MID(A7,SEARCH("B*:",A7)+4,3)
=MID(A7,SEARCH("|C:",A7)+4,3)
A7 is the cell that you use to extract.
Hope it help you.
This comment was minimized by the moderator on the site
Bonjour,

J'ai un texte AAMMJJ que je souhaite transformer en JJMMAAAA
Sunny     GG
This comment was minimized by the moderator on the site
Hi, GG, try this formula =TEXTE(date; "jj/mm/aaaa")
There are no comments posted here yet
Load More
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations