
Master LEFT, RIGHT, MID, TRIM, CONCATENATE, LEN and more — with real-world examples.
What You’ll Learn
Text functions in Excel are the reason a data-cleaning job that used to take you all afternoon can be finished before your coffee gets cold. Picture this: you have just received a staff list exported from your HR system. Eight hundred rows. Every name is formatted as SMITH, JOHN in a single column. Your manager wants it split into first and last name columns by end of day. Without text functions, that is a long afternoon of copy-paste and manual typing. With them, it is three formulas and ten minutes.
Whether you are dealing with invisible spaces that break your VLOOKUPs, product codes you need to slice up for a pivot table, or customer names imported in the wrong case, the Excel text formula toolkit has you covered. This guide covers every essential function, organised around three practical jobs: extracting the text you need, cleaning the text that is broken, and combining text to build something new.
By the end, you will have a clear mental model for choosing the right function — not just a list of syntax to memorise.
Numbers in Excel are straightforward. Add them, average them, look them up. Text is a different story. It comes from everywhere — exported from a CRM, pasted from a website, typed by twelve different people with twelve different habits. It arrives inconsistent, padded with spaces you cannot see, capitalised randomly, and formatted in ways that make your formulas fall apart.
Text functions in Excel give you a way to deal with all of that without touching the original data. You can measure text, slice it, clean it, reformat it, and stitch pieces together — all with a formula in a clean helper column. Once you get comfortable with these tools, you will stop thinking of messy data as a problem and start thinking of it as something you know exactly how to fix.
You have probably seen at least one of these situations before:
Any of those ring a bell? Keep reading.
Rather than listing twenty functions in alphabetical order, here is a framework that makes the whole toolkit easier to use. Every text function in Excel does one of three jobs:
LEFT grabs a number of characters from the start of a text string. RIGHT grabs from the end. The choice between them comes down to where your data lives in the string.
Syntax
LEFT(text, num_chars)
Advertisement-X
RIGHT(text, num_chars)
Example — if A2 contains “ABCDEF”:
=LEFT(A2,3) → ABC
=RIGHT(A2,3) → DEF
⚠️ Common Mistake
Hardcoding a fixed number of characters is where people get caught out. If your data is not perfectly uniform, =LEFT(A2,3) will quietly return wrong results the moment a row has a slightly different format. The fix: combine LEFT or RIGHT with FIND to make the extraction dynamic.
MID pulls characters from somewhere in the middle of a string. You tell it where to start and how many characters to take. It is the go-to formula for structured text like reference numbers, product codes, or ID strings where the piece you need always sits at a predictable position.
Syntax
MID(text, start_num, num_chars)
Example — if A2 contains “ABCDEFGH”:
=MID(A2,3,4) → CDEF
💡 Pro Tip
Combine MID with FIND and you unlock something much more powerful. Instead of hardcoding the start position, use FIND to locate a delimiter like a dash or a space, then add one to start immediately after it. Your formula adapts to strings of different lengths automatically.
Both FIND and SEARCH locate the position of one piece of text inside another and return a number. The important difference: FIND is case-sensitive. SEARCH is not. SEARCH also supports wildcards; FIND does not.
Syntax
FIND(find_text, within_text, [start_num])
SEARCH(find_text, within_text, [start_num])
Example — find position of first dash in A2:
=FIND(“-“,A2) → returns position number
Here is the thing about data that comes from outside your spreadsheet: it almost always carries hidden baggage. When someone exports a CSV from a CRM, copies a table from a website, or sends you data from a legacy system, the text in those cells often has extra spaces hiding at the start, the end, or between words. You cannot see them. They are invisible. But Excel sees them — and they cause real problems.
Think of TRIM like a firm handshake for your data. It removes every extra space, leaves exactly one space between each word, and returns clean text you can actually work with.
Syntax
TRIM(text)
Example — cell A2 contains ” John Smith “:
=TRIM(A2) → “John Smith”
⚠️ Common Mistake
Assuming data from a clean-looking source has no hidden spaces. It almost always does. Build a habit of running TRIM on any data that did not originate in your own spreadsheet. To Excel, ” John Smith” and “John Smith” are completely different values — a VLOOKUP trying to match them will fail silently.
💡 Pro Tip
Use LEN before and after TRIM to prove the spaces were there. If =LEN(A2) returns 14 and =LEN(TRIM(A2)) returns 10, that cell had four hidden characters. That is your evidence the source data is dirty, and a convincing way to demonstrate a data quality issue to a colleague who cannot see the problem.
LEN counts the number of characters in a text string, including every space. You will use it in two ways: as a diagnostic tool to measure string length and flag unexpected values, and as a helper inside other formulas to make extractions dynamic.
Syntax
LEN(text)
Classic LEN + RIGHT combo — extract everything after the first dash:
=RIGHT(A2, LEN(A2)-FIND(“-“,A2))
Three functions, one job: standardise how text is capitalised. You will reach for these most often when preparing data for a VLOOKUP where case inconsistency might cause failures, or when formatting names for a mail merge.
Syntax
UPPER(text) → Converts all characters to capitals
LOWER(text) → Converts all characters to lowercase
PROPER(text) → Capitalises the first letter of each word
Examples:
=PROPER(“john smith”) → John Smith
=LOWER(“QUARTERLY REPORT”) → quarterly report
⚠️ Common Mistake
PROPER does not handle every name correctly. Double-barrelled names, names with apostrophes, and surnames like McDonald can come out wrong. For anything going into an important document, review the output before you use it.
CONCATENATE joins text strings together. If A2 contains “John” and B2 contains “Smith”, the formula below returns “John Smith”. The space between the quote marks is a literal space character being inserted between the two values.
Syntax — Three Ways to Join Text
CONCATENATE(text1, text2, …)
CONCAT(text1, text2, …) ← Modern; accepts ranges
text1 & ” ” & text2 ← Ampersand shortcut
All three return the same result:
=CONCATENATE(A2,” “,B2) → John Smith
TEXTJOIN joins a range of values using a delimiter you choose, and lets you decide whether to skip blank cells. It is far more powerful than CONCATENATE for anything involving a range.
Syntax
TEXTJOIN(delimiter, ignore_empty, text1, text2, …)
Join city names in A2:A6, skip blank cells:
=TEXTJOIN(“, “, TRUE, A2:A6) → London, Paris, Berlin
| Function | Accepts Ranges | Custom Delimiter | Skips Blank Cells | Version |
|---|---|---|---|---|
| CONCATENATE | ✗ | ✗ | ✗ | All versions |
| CONCAT | ✓ | ✗ | ✗ | 2019 / 365 |
| TEXTJOIN | ✓ | ✓ | ✓ | 2019 / 365 |
The TEXT function converts a number or date value into a text string formatted exactly the way you specify. This is most useful when you need to embed a number or date inside a sentence. Without TEXT, concatenating a date cell directly gives you a meaningless serial number like 46218.
Syntax
TEXT(value, format_text)
Embed a live date in a sentence (A2 = 27/04/2026):
=”Report generated on “&TEXT(A2,”DD MMMM YYYY”)
→ “Report generated on 27 April 2026”
Individual functions are useful. Combined, they solve problems that would otherwise take hours. Here are three real-world examples that show the toolkit in action.
Your HR export has names formatted as SMITH, JOHN in a single column. You need them separated.
Step-by-Step
Step 1. Extract the last name — everything before the comma:
=LEFT(A2, FIND(“,”,A2)-1)
Step 2. Extract the first name — everything after the comma and space:
=MID(A2, FIND(“,”,A2)+2, LEN(A2))
Step 3. Rebuild as First Last in one formula:
=MID(A2,FIND(“,”,A2)+2,LEN(A2))&” “&LEFT(A2,FIND(“,”,A2)-1)
Your SKUs follow the format CATEGORY-PRODUCTNAME-SIZE-COLOUR. You need just the category. Because the category always sits before the first dash, one formula handles every row cleanly — no matter how long or short the category code is.
Formula
=LEFT(A2, FIND(“-“,A2)-1)
Applied to “CAT-SHOES-42-BLK” → returns CAT
Your VLOOKUP is returning errors. Both columns look identical. You have checked the spelling twice. The culprit is almost always hidden spaces. Here is how to diagnose and fix it. For a full VLOOKUP walkthrough, see Lesson 15: INDEX & MATCH in Excel on XplorExcel.
Step-by-Step
Step 1. Add a LEN column to diagnose hidden characters:
=LEN(A2) — compare result against expected length
Step 2. Wrap the lookup value in TRIM inside your VLOOKUP:
=VLOOKUP(TRIM(A2), $D$2:$E$100, 2, FALSE)
Step 3. If the table data is also from an external source, clean that column first in a helper column, then point your VLOOKUP there.
| Function | What It Does | Basic Syntax |
|---|---|---|
| LEFT | Extract from start of string | =LEFT(text, num_chars) |
| RIGHT | Extract from end of string | =RIGHT(text, num_chars) |
| MID | Extract from middle of string | =MID(text, start, num_chars) |
| FIND | Locate text (case-sensitive) | =FIND(find_text, within_text) |
| SEARCH | Locate text (not case-sensitive) | =SEARCH(find_text, within_text) |
| TRIM | Remove extra spaces | =TRIM(text) |
| LEN | Count characters in a cell | =LEN(text) |
| UPPER | Convert to uppercase | =UPPER(text) |
| LOWER | Convert to lowercase | =LOWER(text) |
| PROPER | Capitalise each word | =PROPER(text) |
| CONCATENATE | Join text strings (legacy) | =CONCATENATE(text1, text2) |
| CONCAT | Join text and ranges (modern) | =CONCAT(text1, text2) |
| TEXTJOIN | Join with delimiter, skip blanks | =TEXTJOIN(delim, ignore, text) |
| TEXT | Format number or date as text | =TEXT(value, format_text) |
🧪 Practice Exercise — SKU Data Extraction
Open a blank workbook and try this five-step exercise to put LEFT, MID, FIND, and LEN to work together.
1. In A1, type: SKU Data
2. In cells A2 through A5, enter these values:
ELEC-TV-55-BLK
ELEC-TV-43-WHT
HOME-SOFA-3S-GRY
HOME-LAMP-FLR-SLV
3. In B2, write a formula using LEFT and FIND to extract the department code (e.g. ELEC, HOME).
4. In C2, write a formula using MID and FIND to extract the product type — the second segment.
5. In D2, use LEN on the original cells to confirm no trailing spaces exist in the source data.
If your B2 formula returns the department code correctly for all four rows, you are using FIND and LEFT together properly. If it fails on any row, check whether you are using FIND to locate the delimiter dynamically rather than hardcoding a character count.
FIND is case-sensitive and does not accept wildcard characters. SEARCH is not case-sensitive and does accept wildcards. Use FIND when the exact case of the character matters. Use SEARCH when you want to match regardless of case or when you need a wildcard pattern.
TRIM is the function for this. It removes leading spaces, trailing spaces, and any runs of double spaces within the string, handling the vast majority of space problems from imported data. If you are dealing with non-breaking spaces copied from a website, those require SUBSTITUTE with CHAR(160) as well, since TRIM does not catch that particular character.
CONCAT and TEXTJOIN are the modern replacements, both available in Excel 2019 and Excel 365. CONCAT works identically to CONCATENATE but also accepts cell ranges. TEXTJOIN adds a delimiter argument and the ability to ignore blank cells, making it far more powerful for range-based joining.
Yes, and the TEXT function is the key to doing it well. Without TEXT, concatenating a number or date cell directly gives you the raw stored value — a serial number for dates, and an unformatted integer for numbers. Use TEXT to specify exactly how you want the value to appear before joining it with the rest of your string.
📚 Recommended External Resources
The official syntax reference for the TEXT function, including every format code for dates, currency, percentages, and custom patterns.
One of the most thorough practical references available for TEXTJOIN, with worked examples covering version compatibility and advanced use cases.
📖 Continue Learning on XplorExcel
Want to combine text functions with conditional logic? Head to Lesson 15: INDEX & MATCH in Excel — where you will learn how to build smarter lookups that pair perfectly with the TRIM and text-cleaning techniques from this lesson.
Ready to go further? Lesson 17: Date & Time Functions in Excel builds directly on what you just learned about the TEXT function and how Excel stores dates as serial numbers.
Previous Lesson
Next Lesson
Advertisement-X