text functions in Excel — XplorExcel tutorial

 
Lesson 16
Intermediate
⏱ 10 min read

Text Functions in Excel: The Complete Guide

Master LEFT, RIGHT, MID, TRIM, CONCATENATE, LEN and more — with real-world examples.

What You’ll Learn

  • How to extract text with LEFT, RIGHT, MID, FIND, and SEARCH
  • How to clean messy data using TRIM, LEN, and case functions
  • How to combine text with CONCATENATE, CONCAT, and TEXTJOIN
  • How to format numbers and dates as readable text using TEXT
  • How to combine functions to solve real-world data problems

Ads loading…

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.

What Are Text Functions in Excel and Why Do They Matter

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.

When You Actually Need a Text Formula

You have probably seen at least one of these situations before:

  • A name list formatted as Last, First that needs to become First Last
  • A column of product codes like CAT-SHOES-42-BLK where you only need one segment
  • A VLOOKUP returning errors even though the values look identical in both columns
  • A report where you need a cell to read “Sales as of 27 April 2026” using a live date
  • Phone numbers entered in five different formats across five hundred rows

Any of those ring a bell? Keep reading.

The Three Jobs of Excel Text Functions

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:

  • Extract — Pull a specific piece of text out of something larger. LEFT, RIGHT, MID, FIND, and SEARCH live here.
  • Clean — Fix text that arrived broken, padded, or formatted incorrectly. TRIM, LEN, UPPER, LOWER, and PROPER are your tools.
  • Combine — Build a new text string by joining pieces together. CONCATENATE, CONCAT, the ampersand shortcut, and TEXTJOIN do this work.

Extract: Pull the Text You Need

Excel LEFT and RIGHT Functions

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)

Ads loading…

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.

Excel MID Function

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.

Excel FIND and SEARCH Functions

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

Clean: Fix Messy or Inconsistent Data

Excel TRIM Function — The Most Underused Formula

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.

Excel LEN Function

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))

UPPER, LOWER, and PROPER Functions

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.

Combine: Build New Text from Existing Data

Excel CONCATENATE Function and Why You Should Upgrade

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: The Function CONCATENATE Should Have Been

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

FunctionAccepts RangesCustom DelimiterSkips Blank CellsVersion
CONCATENATEAll versions
CONCAT2019 / 365
TEXTJOIN2019 / 365

TEXT Function: Formatting Numbers as Text

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”

Combining Text Functions in Excel: Where the Real Power Is

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.

Use Case 1: Split Full Names into First and Last

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)

Use Case 2: Extract a Product Category from a SKU Code

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

Use Case 3: Fix VLOOKUP Errors Caused by Hidden Spaces

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.

Quick Reference: Excel Text Functions Cheat Sheet

FunctionWhat It DoesBasic Syntax
LEFTExtract from start of string=LEFT(text, num_chars)
RIGHTExtract from end of string=RIGHT(text, num_chars)
MIDExtract from middle of string=MID(text, start, num_chars)
FINDLocate text (case-sensitive)=FIND(find_text, within_text)
SEARCHLocate text (not case-sensitive)=SEARCH(find_text, within_text)
TRIMRemove extra spaces=TRIM(text)
LENCount characters in a cell=LEN(text)
UPPERConvert to uppercase=UPPER(text)
LOWERConvert to lowercase=LOWER(text)
PROPERCapitalise each word=PROPER(text)
CONCATENATEJoin text strings (legacy)=CONCATENATE(text1, text2)
CONCATJoin text and ranges (modern)=CONCAT(text1, text2)
TEXTJOINJoin with delimiter, skip blanks=TEXTJOIN(delim, ignore, text)
TEXTFormat number or date as text=TEXT(value, format_text)

Try It Yourself

🧪 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.

Frequently Asked Questions

What is the difference between FIND and SEARCH in Excel?

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.

How do I remove spaces in Excel?

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.

What replaced CONCATENATE in Excel?

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.

Can I combine text and numbers in Excel?

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

Microsoft Support — TEXT Function Reference

The official syntax reference for the TEXT function, including every format code for dates, currency, percentages, and custom patterns.

Exceljet — TEXTJOIN Function Examples and Version Notes

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.

Ads loading…

Advertisement-X