Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Pick Out Certain Text in Excel

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To pick out certain text in Excel, you can use a formula like =MID(A1, FIND("start",A1)+LEN("start"), FIND("end",A1)-FIND("start",A1)-LEN("start")) to extract characters between two markers, or use Text to Columns or Flash Fill for pattern-based extraction. The best method depends on whether the text follows a consistent pattern (e.g., always after a dash) or you just need to grab a fixed number of characters. This guide walks through the most reliable ways to isolate the text you want, with exact steps and fixes for common errors.

What You'll Need

  • Microsoft Excel (desktop version recommended for Flash Fill and Text to Columns; Excel for the web supports many formulas but not all features).
  • Your data in a single column, ideally with a clear pattern (e.g., "Product-1234", "John Smith (Sales)").
  • Basic familiarity with Excel formulas and the ribbon.

Step-by-Step

  1. Identify the pattern. Look at your text and decide what marks the start and end of the part you want. For example, if you want the number after a hyphen in "Order-5678", the hyphen is the start marker and the end of the cell is the end. If the text is always the first 5 characters, note that.
  2. Choose your method. For consistent patterns (same delimiter or fixed length), use formulas. For one-off extraction where you can show Excel an example, use Flash Fill. For splitting a column by a delimiter, use Text to Columns.
  3. Using a formula for text after a delimiter: In a new column, enter =MID(A1, FIND("-",A1)+1, LEN(A1)-FIND("-",A1)). This finds the hyphen, starts one character after it, and takes the rest of the string. Replace "-" with your delimiter (e.g., "," or " ").
  4. Using a formula for text between two delimiters: Enter =MID(A1, FIND("(",A1)+1, FIND(")",A1)-FIND("(",A1)-1). This extracts what's inside parentheses. Adjust the delimiters as needed.
  5. Using a formula for a fixed number of characters: Use =LEFT(A1,5) for the first 5 characters, =RIGHT(A1,4) for the last 4, or =MID(A1,3,7) to start at character 3 and take 7 characters.
  6. Copy the formula down. Drag the fill handle (small square at the bottom-right of the cell) down to apply the formula to all rows. Check a few results to ensure they match your expectation.
  7. Convert formulas to values (optional but recommended). Select the new column, copy it (Ctrl+C), then right-click and choose Paste Special > Values to replace formulas with static text. This prevents errors if the source data changes.
  8. Using Flash Fill (Excel desktop only): In the column next to your data, type the extracted text for the first row as an example. Press Enter, then start typing the second row's result. Excel should show a preview; press Enter to accept. If not, go to the Data tab and click Flash Fill (or press Ctrl+E).
  9. Using Text to Columns: Select your data column, go to Data > Text to Columns. Choose Delimited and click Next. Tick your delimiter (e.g., comma, space, hyphen) and click Next. Choose where to place the output (default is the same column; change to avoid overwriting) and click Finish.
  10. Verify and clean up. Check for extra spaces using =TRIM() around your formula, and remove any helper columns you no longer need.

Common Mistakes

  • Forgetting that FIND is case-sensitive. Use SEARCH instead if case doesn't matter. For example, =MID(A1, SEARCH("x",A1)+1, 10).
  • Not handling missing delimiters. If the delimiter isn't found, FIND returns an error (#VALUE!). Wrap in IFERROR: =IFERROR(MID(A1, FIND("-",A1)+1, LEN(A1)), "Not found").
  • Off-by-one errors. Remember that FIND returns the position of the delimiter; you often need +1 to start after it, and subtract lengths correctly for the number of characters.
  • Using Flash Fill on inconsistent data. Flash Fill needs a clear pattern; if rows vary, it may produce wrong results. Always spot-check.
  • Overwriting original data with Text to Columns. Choose a different destination column to preserve your source.

Tips

  • Use LEN and FIND together to calculate lengths dynamically, so your formula adapts to varying text lengths.
  • For complex patterns (e.g., extracting email addresses), consider Power Query (Data > Get & Transform) which has more robust text extraction tools.
  • Test your formula on a few rows before filling down, especially with special characters like parentheses or asterisks that may need escaping.
  • Combine SUBSTITUTE to replace delimiters before extraction if you have multiple possible markers.

Troubleshooting

  • Formula returns #VALUE!: The delimiter isn't present in that cell. Use IFERROR to handle gracefully, or check for typos in the delimiter.
  • Flash Fill not working: Ensure you're in the desktop version (not Excel for the web). Also, Flash Fill may be disabled: go to File > Options > Advanced and ensure Enable Flash Fill is ticked.
  • Text to Columns splits incorrectly: Check that you selected the right delimiter. If your data has multiple delimiters, use the Other box to specify a custom one.
  • Results include extra spaces: Wrap your formula in TRIM() to remove leading/trailing spaces.
  • Formula works for some rows but not others: The pattern likely varies. Inspect the failing rows and adjust your formula or use a more flexible method like Power Query.

Frequently Asked Questions

Can I extract text without formulas?

Yes, use Flash Fill (Ctrl+E) or Text to Columns for delimiter-based splits. These are quick for one-time tasks but not dynamic.

How do I extract text between two different characters?

Use MID with two FIND functions: =MID(A1, FIND("[",A1)+1, FIND("]",A1)-FIND("[",A1)-1) extracts text between square brackets.

Why does my formula return the wrong number of characters?

Double-check the start position and length arguments. Remember that FIND counts from 1, and LEN returns total characters. A common error is forgetting to subtract the start position from the length.

Can I use these methods in Excel for the web?

Most formulas work in Excel for the web, but Flash Fill and some advanced Text to Columns options are not available. Stick to formulas for web use.

How do I extract the first word from a cell?

Use =LEFT(A1, FIND(" ",A1)-1) to get text before the first space. If there's no space, wrap in IFERROR to return the whole cell.

Is there a way to extract all matches of a pattern?

For multiple occurrences, use Power Query or VBA. Simple formulas extract only the first match. Power Query's Column From Examples can handle multiple patterns.