Excel's string functions let you clean, split, combine and extract text from messy data without retyping anything. The core set you need is LEFT, RIGHT, MID, LEN, FIND, SEARCH, SUBSTITUTE, TRIM, UPPER, LOWER, PROPER, CONCAT and TEXTJOIN. This guide walks through each one with a worked example, then shows how to nest them into real cleanup formulas. Everything works in Excel for Microsoft 365, Excel 2021 and Excel 2019; a few newer functions such as TEXTJOIN and CONCAT are not in Excel 2016 or earlier, and the guide notes where that matters. Menu and ribbon labels can differ slightly by version and region.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, Excel 2019, or Excel for the web. TEXTJOIN and CONCAT require Excel 2019 or later, or Microsoft 365.
  • A worksheet with a column of text to practise on, or type sample values into cells A2 to A6.
  • Basic familiarity with typing a formula and pressing Enter.

Step-by-Step

  1. Set up sample data. In cells A2 to A6, type: John Smith , Jane Doe, jane.doe@example.com, Order-2024-0187, and extra spaces . Put your formulas in column B so you can see the result next to the source.
  2. Measure length with LEN. In B2 type =LEN(A2). LEN counts every character, including spaces, so the padded name returns a higher number than you might expect. This is the quickest way to confirm whether stray spaces exist.
  3. Remove extra spaces with TRIM. In B3 type =TRIM(A2). TRIM strips leading and trailing spaces and collapses runs of internal spaces to one. Use it before any other text function, because a trailing space will break exact-match lookups and comparisons.
  4. Extract from the left with LEFT. In B4 type =LEFT(A4,4) to return the first four characters of the email address, which gives jane. LEFT takes the text and a number of characters. If you omit the number, it defaults to 1.
  5. Extract from the right with RIGHT. In B5 type =RIGHT(A5,4) to pull the last four characters of the order code, giving 0187. RIGHT works the same way as LEFT but counts from the end.
  6. Extract from the middle with MID. In B6 type =MID(A5,7,4). MID takes the text, a starting position, and a length, so it returns 2024 from the order code. Position 1 is the first character.
  7. Find a character's position with FIND and SEARCH. In B7 type =FIND("@",A4) to get the position of the at-sign in the email address. FIND is case-sensitive; SEARCH is not. Use FIND when case matters, SEARCH when it does not.
  8. Replace text with SUBSTITUTE. In B8 type =SUBSTITUTE(A5,"-"," ") to turn Order-2024-0187 into Order 2024 0187. SUBSTITUTE replaces every occurrence by default; add a fourth argument to replace only the nth instance.
  9. Change case with UPPER, LOWER and PROPER. In B9 type =UPPER(A3) for all caps, =LOWER(A3) for all lowercase, and =PROPER(A3) to capitalise the first letter of each word. PROPER is useful for names but will also capitalise after hyphens, so check results like Mary-Jane.
  10. Join text with CONCAT and TEXTJOIN. In B10 type =CONCAT(A2," ",A3) to glue two cells together with a space. In B11 type =TEXTJOIN(", ",TRUE,A2:A6) to join a whole range with a comma and space, ignoring empty cells. TEXTJOIN needs Excel 2019 or later.
  11. Nest functions into a real cleanup formula. To pull the username from an email address, combine LEFT and FIND: =LEFT(A4,FIND("@",A4)-1). The FIND locates the at-sign, the minus 1 stops before it, and LEFT returns everything to the left. To get the domain, use =MID(A4,FIND("@",A4)+1,LEN(A4)).
  12. Test with edge cases. Add a blank cell, a cell with only spaces, and a cell with a different separator. Run your formulas against them. A formula that works on clean data often fails on real exports, and catching that now saves rework later.

Common Mistakes

  • Forgetting TRIM first. A trailing space makes "Jane" and "Jane " look identical but compare as different. Wrap source cells in TRIM before extracting or matching.
  • Confusing FIND and SEARCH. FIND is case-sensitive and does not accept wildcards; SEARCH is case-insensitive and does. Using the wrong one gives a #VALUE! error or the wrong position.
  • Off-by-one errors in MID. The second argument is the starting position, not the number of characters to skip. If your result is shifted by one, check that first.
  • Assuming SUBSTITUTE replaces only once. It replaces all occurrences unless you supply the instance number. To change only the first hyphen, use =SUBSTITUTE(A5,"-"," ",1).
  • Hard-coding character counts. Typing =LEFT(A4,4) works until a shorter value arrives. Derive the count with FIND or LEN so the formula adapts.
  • Using CONCAT or TEXTJOIN in older Excel. Both return #NAME? in Excel 2016 and earlier. Use the ampersand operator instead: =A2&" "&A3.

Tips

  • Use the ampersand (&) for simple joins; it works in every Excel version and is easier to read than CONCAT for two or three items.
  • Wrap formulas in IFERROR to hide errors during cleanup: =IFERROR(LEFT(A4,FIND("@",A4)-1),"") returns a blank instead of #VALUE! when no at-sign exists.
  • Press F9 while editing a formula to see the result of the selected part, which is the fastest way to debug a nested formula.
  • Keep a helper column with the raw value and a second column with the cleaned value. Overwriting the source makes it impossible to check your work.
  • Use Text to Columns on the Data tab when you need to split a whole column by a delimiter; it is faster than writing MID and FIND for every row.

Troubleshooting

  • #VALUE! error. Usually FIND or SEARCH cannot locate the character. Check for a trailing space, a different symbol (such as a full stop instead of a comma), or a case mismatch if you used FIND.
  • #NAME? error. The function is not available in your Excel version, or the name is misspelled. TEXTJOIN and CONCAT need Excel 2019 or later.
  • Result looks correct but comparisons fail. The cell may contain a non-breaking space, which TRIM does not remove. Use =SUBSTITUTE(A2,CHAR(160)," ") then TRIM.
  • Numbers treated as text. LEFT, RIGHT and MID always return text. Wrap the result in VALUE to convert it back to a number before doing arithmetic.
  • Formula works in one cell but not when filled down. Check that relative references are correct and that absolute references use the dollar sign where needed.

Frequently Asked Questions

What is the difference between FIND and SEARCH?

FIND is case-sensitive and does not allow wildcards. SEARCH is case-insensitive and does allow wildcards such as the question mark and asterisk. Use FIND when exact case matters and SEARCH when it does not.

Can I split a full name into first and last name?

Yes. Use =LEFT(A2,FIND(" ",A2)-1) for the first name and =MID(A2,FIND(" ",A2)+1,LEN(A2)) for the rest. This assumes a single space between names; names with middle names or multiple spaces need extra handling.

Why does LEN return a bigger number than I expect?

LEN counts every character, including leading and trailing spaces and non-printing characters. Wrap the cell in TRIM and compare the two LEN results to see how many spaces were removed.

Do string functions work on numbers?

Yes. Excel converts numbers to text automatically when you pass them to LEFT, RIGHT, MID or LEN. The result is text, so wrap it in VALUE if you need to calculate with it afterwards.

How do I remove the first few characters from every cell?

Use MID with a starting position past the characters you want to drop. For example, =MID(A2,4,LEN(A2)) removes the first three characters from every row.

Can I combine text from multiple cells with a line break?

Yes. Use TEXTJOIN with CHAR(10) as the delimiter and turn on Wrap Text for the cell. On Windows, CHAR(10) inserts a line break; on Mac, CHAR(13) is sometimes needed depending on the version.