Excel Formula to Extract Text Inside Parentheses

📅 Jul 16, 2026 📝 Sarah Miller

Managing messy Excel datasets can be incredibly frustrating when you need to isolate specific data points. This is especially common when tracking standard funding sources, where critical identifiers are often buried within descriptive text. Having streamlined, clean data grants analysts the ability to generate accurate reports instantly and make informed decisions.

Stipulation: This extraction method assumes a single set of parentheses per cell. For example, isolating "DE-99" from "Federal Allocation (DE-99)" dramatically accelerates database reconciliation.

Below, we outline the exact formula utilizing the MID and SEARCH functions to automate this extraction process seamlessly.

Excel Formula to Extract Text Inside Parentheses

When working with imported databases, ERP outputs, or web-scraped data in Excel, you will often find valuable information wrapped inside parentheses. Whether it is an area code in a phone number, a stock ticker symbol, an airport code, or an employee ID, getting rid of the excess text outside of these brackets is a common data-cleaning task.

Depending on your version of Excel, there are several ways to "trim" or remove the text outside of parentheses to isolate only what is inside. This guide covers the best methods, ranging from classic formulas compatible with older versions of Excel to modern, elegant formulas available in Excel 365, as well as non-formula alternatives like Flash Fill.

Understanding the Goal

Before diving into the formulas, let's clarify what we want to achieve. Suppose you have a list of data in column A that looks like this:

  • John Doe (ID-8921) → Target Output: ID-8921
  • Chicago O'Hare (ORD) → Target Output: ORD
  • Red widget (SKU_991) - In Stock → Target Output: SKU_991

We want to strip away everything before the opening parenthesis ( and everything after the closing parenthesis ), leaving only the bracketed text itself.


Method 1: The Modern Excel 365 Formula (Easiest & Cleanest)

If you are using Excel 365 or Excel 2021/2024, you have access to new text manipulation functions that make this task incredibly easy. By nesting the TEXTBEFORE and TEXTAFTER functions, you can extract the target text without complex math.

The Formula:

=TEXTBEFORE(TEXTAFTER(A2, "("), ")")

How It Works:

  1. TEXTAFTER(A2, "(") looks at the text in cell A2 and extracts everything that comes after the first opening parenthesis. For John Doe (ID-8921), this part returns ID-8921).
  2. TEXTBEFORE(..., ")") takes that intermediate result and extracts everything that comes before the closing parenthesis. This leaves us with just ID-8921.

This formula is highly intuitive and eliminates the need to calculate character positions manually.


Method 2: The Classic Excel Formula (Compatible with All Versions)

If you are working on an older version of Excel (such as Excel 2019, 2016, or 2013) or need your workbook to be compatible with legacy installations, you must use a combination of MID, SEARCH (or FIND), and LEN.

The Formula:

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

How It Works:

The MID function extracts a specific number of characters from a text string, starting at a position you specify. The syntax is: =MID(text, start_num, num_chars). Here is how we feed it the correct parameters:

  • text: This is our source cell, A2.
  • start_num (Where to start extracting): We want to start extracting exactly one character after the opening parenthesis. SEARCH("(", A2) finds the numerical position of (. We add + 1 to get the position of the first character inside the parentheses.
  • num_chars (How many characters to extract): To find the length of the string inside the parentheses, we subtract the position of the opening parenthesis from the position of the closing parenthesis, and then subtract 1 to adjust for the characters themselves. Mathematically: SEARCH(")", A2) - SEARCH("(", A2) - 1.

Step-by-Step Example:

Let's apply this formula to the text: Atlanta (ATL) in cell A2.

  • SEARCH("(", A2) returns 9 (the 9th character is the open parenthesis).
  • SEARCH(")", A2) returns 13 (the 13th character is the close parenthesis).
  • The start position is 9 + 1 = 10.
  • The number of characters to extract is 13 - 9 - 1 = 3.
  • The formula evaluates to =MID(A2, 10, 3), which returns ATL.

Handling Errors and Edge Cases

In the real world, data is rarely perfect. Some of your cells might not contain parentheses at all, or they might contain empty parentheses. Left unhandled, the classic formula will return a frustrating #VALUE! error if a parenthesis is missing.

1. Preventing Errors with IFERROR

To keep your spreadsheet looking clean, wrap your formula in the IFERROR function. This allows you to specify what Excel should return if it cannot find any parentheses (e.g., a blank cell or a custom message).

=IFERROR(TEXTBEFORE(TEXTAFTER(A2, "("), ")"), "")

For older Excel versions:

=IFERROR(MID(A2, SEARCH("(", A2) + 1, SEARCH(")", A2) - SEARCH("(", A2) - 1), "No Parentheses Found")

2. Dealing with Multiple Sets of Parentheses

If a cell contains more than one set of parentheses-for example, Project (A) Detail (v2)-the default behavior of SEARCH is to find the first occurrence. Thus, both formulas above will extract A.

If you want to extract the content of the last set of parentheses (e.g., v2), you can leverage the modern Excel 365 functions by utilizing their optional match occurrence parameters, or use a classic substitution trick. In Excel 365, you can search from the end of the text string by specifying a negative instance number in TEXTAFTER:

=TEXTBEFORE(TEXTAFTER(A2, "(", -1), ")")

The -1 tells Excel to look for the very last opening parenthesis in the string, ensuring you isolate the final parenthetical block.


A Practical Visual Guide

Here is a quick look at how these formulas perform across different data structures:

Original Text (Column A) Desired Output Excel 365 Formula Result Classic Formula Result
Boston (BOS) BOS BOS BOS
Product Suite (Premium Version) Premium Version Premium Version Premium Version
No brackets here (Blank) (Blank - using IFERROR) #VALUE! (without IFERROR)
Jane Doe (HR) (Manager) HR (or Manager) HR (Defaults to first) HR

Alternative: Flash Fill (No Formulas Required)

If you only need to clean your data once and do not need a dynamic formula that updates when values change, Excel's Flash Fill is an incredibly fast, AI-powered alternative.

  1. Insert a new, blank column next to your source data.
  2. In the first row of your new column, manually type the value that is inside the parentheses of the adjacent cell. (For example, if A2 is John Doe (ID-89), type ID-89 in B2).
  3. Press Enter to move to the next row down.
  4. Press the keyboard shortcut Ctrl + E (or navigate to the Data tab and click Flash Fill).
  5. Excel will detect the pattern instantly and fill the entire column with the text extracted from the parentheses.

Summary

Trimming text outside of parentheses in Excel does not require writing complex VBA macros. For day-to-day work with Excel 365, the nested =TEXTBEFORE(TEXTAFTER(A2, "("), ")") formula is the modern standard. For shared spreadsheets that must run across older installations, the trusty combination of MID and SEARCH remains a bulletproof solution. Always remember to add IFERROR to handle inconsistent data rows and ensure a clean, professional workbook layout.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.