Skip to main content

📊 Lesson 2.3: Text & Date Functions — TEXTJOIN, LEFT/RIGHT/MID & Working with Dates

Not everything in a spreadsheet is a number. Names arrive jumbled, capitalization is inconsistent, extra spaces sneak in, and dates need to be combined, pulled apart, and counted between. This lesson rounds out the Formulas stage by teaching Excel's text and date functions — the tools that clean up and reshape data so the rest of your analysis can trust it. You'll join and split text, standardize messy entries, and finally understand the secret behind date math: Excel quietly stores every date as a number.

📚 What You'll Learn

By the end of this lesson, you will be able to:

  • Combine text with CONCAT and TEXTJOIN (with a delimiter), and pull it apart with LEFT, RIGHT, and MID
  • Measure and clean text with LEN, TRIM, and change case with UPPER, LOWER, and PROPER
  • Explain why Excel stores dates as serial numbers — and why that makes date arithmetic work
  • Use date functions TODAY, DATE, YEAR/MONTH/DAY, EDATE, and DATEDIF, plus TEXT() to format a value as text
  • Choose between a formula and Flash Fill for cleaning up text

⏱️ Estimated Time: 50 minutes

🎯 Project: Clean up a messy contact list — split full names into first and last, standardize the case, and compute days-until-due from a date column.

In This Lesson

Combining Text: CONCAT & TEXTJOIN

Joining pieces of text into one is called concatenation, and it comes up constantly: build a full name from first and last, make a label like "Invoice #1024," or assemble an address. The simplest tool is the ampersand operator, &, which glues text together: =A2&" "&B2 joins A2, a literal space (in quotes), and B2 — so "Ada" and "Lovelace" become "Ada Lovelace." Any text you type literally goes in quotes; the space between the names is the classic thing people forget.

For a cleaner, more readable version there's CONCAT, which joins whatever cells and ranges you give it: =CONCAT(A2, " ", B2) does the same as the ampersand version. (You may see an older function called CONCATENATE — it still works but is being retired in favor of CONCAT.) Where CONCAT shines over & is that it can accept a whole range at once.

The real star is TEXTJOIN, which solves the annoying part of concatenation: repeating the separator. It takes three kinds of input — a delimiter (what to put between each piece), whether to ignore empty cells (TRUE or FALSE), and then the text to join. So =TEXTJOIN(", ", TRUE, A2:A5) joins four cells with a comma-and-space between each, skipping any blanks — producing "apple, pear, plum" without a trailing comma or a gap where an empty cell was. That ignore-empties flag is what makes TEXTJOIN so much nicer than gluing things with & by hand.

Function What it does Example Result
& Glues text together (operator) =A2&" "&B2 Ada Lovelace
CONCAT Joins cells/ranges into one string =CONCAT(A2, " ", B2) Ada Lovelace
TEXTJOIN Joins with a delimiter, can skip blanks =TEXTJOIN(", ", TRUE, A2:A5) apple, pear, plum

⚠️ Version note

TEXTJOIN and CONCAT are modern functions — available in Microsoft 365 / Excel for the web and Excel 2019 and later. Very old perpetual versions (Excel 2016 and earlier) may only have CONCATENATE and the & operator. If a function name isn't recognized, that's usually the reason — the ampersand always works as a fallback.

Splitting Text: LEFT, RIGHT & MID

Just as often you need to extract part of a text value — the first name out of a full name, an area code out of a phone number, a category prefix out of a product code. Three functions pull characters from a string by position:

  • LEFT(text, n) — takes the first n characters from the left. =LEFT("Excel", 2) gives "Ex".
  • RIGHT(text, n) — takes the last n characters from the right. =RIGHT("Excel", 2) gives "el".
  • MID(text, start, n) — takes n characters starting at position start (counting from 1). =MID("Excel", 2, 3) gives "xce".

On their own these are rigid — they need to know exactly how many characters to grab. Their power comes from pairing them with FIND (or SEARCH), which locates a character within text, and LEN, which measures length. For example, to pull the first name out of "Ada Lovelace" in A2, you find the space and take everything before it: =LEFT(A2, FIND(" ", A2) - 1). Reading it: "find the position of the space, then take that many characters minus one (to drop the space itself) from the left." To get the last name, you take everything after the space: =MID(A2, FIND(" ", A2) + 1, LEN(A2)) — start just past the space and grab the rest. These two formulas are the classic "split a full name" pattern, and you'll build them in the project.

📖 Definition

FIND vs SEARCH: both return the position number where one bit of text appears inside another. FIND is case-sensitive and doesn't allow wildcards; SEARCH is case-insensitive and does. For splitting on a space, either works. If you're unsure about capitalization, reach for SEARCH.

Cleaning Text: LEN, TRIM & Changing Case

Real-world data is messy: trailing spaces, ALL CAPS, or inconsistent capitalization from different people typing entries. A few functions tidy all of that.

Function What it does Example Result
LEN Counts the characters in text =LEN("Excel") 5
TRIM Removes extra spaces (leading, trailing, and doubles) =TRIM(" hi there ") hi there
UPPER Converts text to UPPERCASE =UPPER("excel") EXCEL
LOWER Converts text to lowercase =LOWER("EXCEL") excel
PROPER Capitalizes the First Letter Of Each Word =PROPER("ada LOVELACE") Ada Lovelace

TRIM is the unsung hero of data cleanup. Invisible extra spaces are a leading cause of "why won't this match?" bugs — a lookup fails because one cell has a trailing space you can't see. LEN helps you spot them: if =LEN(A2) is larger than the visible characters, there's hidden whitespace. PROPER is perfect for standardizing names typed in a mix of cases, though watch it with names like "McDonald" (it becomes "Mcdonald") and acronyms — PROPER follows a simple first-letter rule, not real-world exceptions.

These functions combine freely. To clean and standardize in one shot, nest them: =PROPER(TRIM(A2)) strips stray spaces and then fixes the capitalization. Building from the inside out — TRIM runs first, then PROPER works on its cleaned result — is exactly the nesting idea from last lesson.

The Secret of Dates: Serial Numbers

Here's the single most useful thing to understand about dates in Excel, and it explains almost everything else: Excel stores every date as a plain number. Specifically, it counts the number of days since a starting point — day 1 is January 1, 1900. So the date January 1, 2000 is stored internally as the number 36526, and today is just a bigger number. What you see as "9/15/2026" is that underlying number wearing a date format. This is called the serial number system.

Once you know that, date math stops being mysterious. Because a date is a number, you can subtract dates to get the days between them: =B2-A2 where both are dates gives a count of days. You can add days to a date: =A2+30 is 30 days after A2. And =A2-TODAY() (from last lesson) tells you how many days until A2 — negative if it's already past. It all works because underneath, you're just doing arithmetic on numbers. Times work the same way: they're stored as the fraction of a day, so 6:00 AM is 0.25 (a quarter of the way through the day).

graph LR A["What you see
9/15/2026"] --> B["What Excel stores
the serial number 46280"] B --> C["So you can do math
subtract, add days, compare"] C --> D["Days until due
due date minus TODAY"]

⚠️ When a date subtraction shows a weird number

If you subtract two dates and the cell shows something like "1/30/1900" instead of "30," the cell picked up a date format from its neighbors. The math is right — 30 days — but it's being displayed as a date. Fix it by formatting the result cell as a plain Number (from Lesson 1.3). Conversely, if a real date shows as a big number like 46280, format it back to a Date. Remember: the value and its display are separate things.

Date Functions & TEXT()

A family of functions builds, breaks apart, and shifts dates. Here are the everyday ones:

Function What it does Example Result
TODAY Today's date (auto-updates) =TODAY() e.g. 9/15/2026
DATE Builds a date from year, month, day =DATE(2026, 12, 25) 12/25/2026
YEAR Pulls the year out of a date =YEAR(A2) 2026
MONTH Pulls the month number (1 to 12) =MONTH(A2) 9
DAY Pulls the day of the month =DAY(A2) 15
EDATE A date N months before/after another =EDATE(A2, 3) 3 months after A2
DATEDIF Difference between two dates in years/months/days =DATEDIF(A2, B2, "d") Days between them

DATE is how you build a real date from separate year, month, and day numbers — handy when those pieces live in different cells: =DATE(C2, D2, E2). The trio YEAR, MONTH, and DAY do the reverse, extracting each part. EDATE is a small gem for anything on a monthly cycle — a subscription renewal three months out is =EDATE(A2, 3), and one month ago is =EDATE(A2, -1) — it even handles month lengths correctly.

DATEDIF — the useful, hidden one

DATEDIF gives the difference between two dates in the unit you choose: "d" for days, "m" for whole months, "y" for whole years. =DATEDIF(A2, B2, "y") is the classic way to compute a whole number of years — an age or a tenure. Here's the quirk worth knowing: DATEDIF is a hidden function — Microsoft kept it for compatibility with older spreadsheets, and although it now has a page on Microsoft Support, Excel won't offer it in autocomplete or the Insert Function list. It still works reliably; you just have to type the whole thing yourself, and the start date must be earlier than the end date. For plain days, =B2-A2 is simpler; reach for DATEDIF when you want whole months or years.

TEXT() — format a value as text

TEXT(value, format) converts a number or date into text formatted exactly how you want, using a format code. It's the bridge between the serial-number world and readable labels. =TEXT(A2, "mmmm d, yyyy") turns a date into "September 15, 2026"; =TEXT(A2, "dddd") gives the weekday name like "Tuesday"; =TEXT(B2, "$#,##0.00") turns a number into "$1,234.50" as text. This is especially useful when concatenating — because gluing a raw date with & shows its ugly serial number, but ="Due "&TEXT(A2, "mmm d") produces a clean "Due Sep 15." Remember that TEXT's output is text, so you can't do further math on it — use it for display, not calculation.

Flash Fill vs Formulas

Excel has a genuinely clever shortcut for text cleanup called Flash Fill. Instead of writing a formula, you just show Excel an example of what you want, and it figures out the pattern and fills the rest. Type "Ada" next to "Ada Lovelace," start typing the next first name, and Excel offers to complete the whole column — first names extracted, no formula in sight. You accept with Enter, or trigger it deliberately with Ctrl+E. It's brilliant for one-off cleanups: splitting names, reformatting phone numbers, combining columns, fixing capitalization.

So when should you use Flash Fill versus a formula? The deciding question is whether the data will change. Flash Fill produces static values — a snapshot. If the source data updates, the Flash Fill results do not follow; you'd have to run it again. A formula like =PROPER(TRIM(A2)) is live — change the source and the result updates instantly, and it works on new rows you add. Use Flash Fill for quick, one-time tidying of a fixed list; use a formula when the data is ongoing or when you want the cleanup to stay correct automatically.

💡 Flash Fill is a desktop-and-web feature — with caveats

Flash Fill is available in the modern desktop app and generally in Excel for the web, though its automatic suggestions are strongest on the desktop. If it doesn't kick in on its own, give it one or two clear examples and press Ctrl+E. For splitting text you'll also meet Text to Columns and, later, Power Query (Lesson 6.2) — different tools for the same job at different scales.

🎯 Project: Clean Up a Messy List

Time to rescue some genuinely messy data — the kind you'll meet constantly in the wild. You'll take a contact list with jumbled full names, inconsistent capitalization, stray spaces, and a due-date column, and turn it into clean, split, standardized data with a live "days until due" figure. This is the data-cleanup skill that makes every later stage — analysis, PivotTables, dashboards — actually trustworthy.

🏋️ Clean and split the list

Objective: Split full names into first and last, standardize the case, and compute days-until-due with date math.

Instructions (about 18 minutes):

  1. (3 min) Set up the messy data. In A1 type Full Name, in B1 Due Date. In A2:A6 type names with inconsistent case and spaces, e.g. ada LOVELACE , Grace HOPPER, alan turing. In B2:B6 type future dates.
  2. (3 min) Clean the names. In C1 type Clean Name; in C2 write =PROPER(TRIM(A2)) and fill down. Watch the spaces vanish and the case normalize.
  3. (4 min) Split the first name. In D1 type First; in D2 write =LEFT(C2, FIND(" ", C2) - 1) and fill down.
  4. (4 min) Split the last name. In E1 type Last; in E2 write =MID(C2, FIND(" ", C2) + 1, LEN(C2)) and fill down.
  5. (2 min) Compute days until due. In F1 type Days Left; in F2 write =B2-TODAY() and fill down. If it shows a date, format F as a plain Number.
  6. (2 min) Make a friendly label. In G1 type Reminder; in G2 write ="Due "&TEXT(B2, "mmm d") and fill down — a clean "Due Sep 15" using TEXT().
💡 Hint — a starter layout
   A                 B          C                    D
1  Full Name         Due Date   Clean Name           First
2    ada LOVELACE    9/20/2026  =PROPER(TRIM(A2))    =LEFT(C2,FIND(" ",C2)-1)
3  Grace HOPPER      10/5/2026  =PROPER(TRIM(A3))    =LEFT(C3,FIND(" ",C3)-1)

   E                              F              G
1  Last                          Days Left      Reminder
2  =MID(C2,FIND(" ",C2)+1,LEN(C2))  =B2-TODAY()  ="Due "&TEXT(B2,"mmm d")

Why it works:
- TRIM removes stray spaces; PROPER fixes capitalization.
- FIND(" ",C2) locates the space; LEFT grabs before it, MID grabs after.
- B2-TODAY() works because dates are stored as numbers.
- TEXT() formats the date as clean text for a label.

If a split name errors with #VALUE!, the cell probably has no space (a single word) — FIND can't find one. If Days Left shows a date, change the number format of column F to Number.

✅ Project Completion Checklist

  • A Clean Name column uses =PROPER(TRIM(...)) to fix spaces and case
  • First and Last name columns split the clean name with LEFT and MID plus FIND
  • A Days Left column computes =B2-TODAY() and shows a plain number
  • A Reminder column builds a friendly label with TEXT()
  • Everything filled down and updates when you change a source name or date

🎯 Quick Quiz

Question 1: Why can you subtract one date from another to get the number of days between them?

Question 2: You need to split a fixed, one-time list of full names into first and last, and the data will never change again. What's the quickest sensible approach?

Best Practices for Text & Dates

✅ Do's

  • TRIM imported data first. Invisible spaces cause mysterious lookup and matching failures — clean before you analyze.
  • Let dates be real dates. Enter them so Excel recognizes them as dates (right-aligned, usable in math), not as text — then all the date functions work.
  • Use TEXT() when combining a date or number into a label, so you get "Due Sep 15" instead of a raw serial number.
  • Choose Flash Fill for one-off cleanups and formulas for living data — match the tool to whether the data will change.

❌ Don'ts

  • Don't assume PROPER handles every name. "McDonald" and "van der Berg" break its simple rule — spot-check and fix by hand.
  • Don't glue a raw date with & — you'll get its serial number. Wrap it in TEXT().
  • Don't expect autocomplete to offer DATEDIF — it's hidden from the list; type the whole thing, oldest date first.
  • Don't do further math on TEXT() output — it's text, not a number.

💡 Pro Tips

  • Nest cleanup functions from the inside out: =PROPER(TRIM(A2)) trims first, then fixes case.
  • If LEN(A2) is bigger than the characters you can see, there's hidden whitespace — a job for TRIM.
  • Once cleaned with formulas, you can copy the column and Paste Special → Values to freeze the results as plain text.

📓 Learning Journal

Add to your learning journal after this lesson. Consider noting:

  • Key concepts you learned (concatenation, splitting text, dates as serial numbers)
  • Techniques that clicked for you (nesting TRIM inside PROPER, LEFT/MID with FIND, date subtraction)
  • Questions or confusion points to revisit
  • Ideas you want to try with your own data
  • Your progress and feelings — did the "dates are numbers" idea change how you see them?

✍️ This lesson's prompt: Think about the messiest data you've ever had to deal with — a list of names, an export from another app, a sign-up sheet. Which functions from this lesson (TRIM, PROPER, LEFT/MID, or a date calculation) would have saved you the most time, and how? Would you reach for Flash Fill or a formula, and why?

📝 Lesson Summary

🎓 Key Takeaways

  • Combine text with &, CONCAT, or — best of all — TEXTJOIN, which joins with a delimiter and can skip empty cells.
  • Split text with LEFT, RIGHT, and MID, usually paired with FIND and LEN to locate and measure.
  • Clean text with TRIM (kill stray spaces) and LEN (spot hidden ones); standardize case with UPPER, LOWER, and PROPER. Nest them: =PROPER(TRIM(A2)).
  • Excel stores dates as serial numbers (days since 1/1/1900), which is exactly why you can subtract, add, and compare them. Times are fractions of a day.
  • Build and dissect dates with DATE, YEAR/MONTH/DAY, EDATE, and DATEDIF (hidden from autocomplete but works); use TEXT() to format a value as readable text. Flash Fill is great for one-off cleanups; formulas stay live.

🎉 What You've Accomplished

You can now reshape and repair data, not just calculate with it — joining and splitting text, standardizing messy entries, and doing genuine date arithmetic once you know dates are secretly numbers. That completes the Formulas stage of the course: you can get clean numbers in, make them calculate, and clean up the words and dates around them. Everything you build from here rests on this foundation.

❓ Common Questions at This Stage

My date subtraction shows a date instead of a number of days. What's wrong?

Nothing is wrong with the math — the result cell just inherited a date format. The value is the correct number of days; it's only being displayed as a date. Select the cell and change its number format to Number (or General) and you'll see the plain count. Value and display are always separate in Excel.

Why can't I find DATEDIF in the autocomplete list?

Because it's a hidden function. Microsoft keeps DATEDIF for compatibility with older spreadsheet software; it's documented on Microsoft Support but not advertised in Excel itself, so it won't appear in autocomplete or the Insert Function list. Just type the whole thing — =DATEDIF(start, end, "y") — with the earlier date first, and it works. For a simple day count, =end-start is easier anyway.

Should I use Flash Fill or write formulas to clean up text?

Ask whether the data will change. Flash Fill makes a one-time static snapshot — perfect for a fixed list you're tidying once. A formula stays live, updating whenever the source changes and applying to new rows. For ongoing or growing data, use formulas; for a quick one-off, Flash Fill (Ctrl+E) is faster.

🔭 Looking Ahead

That wraps up Module 2 and the whole Formulas stage. Next we move into Analysis. In Lesson 3.1: Sorting, Filtering & Excel Tables you'll start asking your data questions — ordering it, narrowing it down to just what you want to see, and turning a plain range into a structured Excel Table that supercharges everything you've learned so far.

✅ Before the Next Lesson

  • Keep your cleaned-up list — you'll sort and filter data like it next
  • Make sure you're comfortable nesting functions (like PROPER(TRIM(...)))
  • Write your Learning Journal entry for this lesson

📚 Additional Resources

🌟 Encouragement for the Journey

You've now got the full Formulas toolkit — numbers, logic, text, and dates. Messy data doesn't stand a chance against you anymore, and you understand the quiet trick (dates are numbers!) that makes so much of Excel click into place. Take a moment to appreciate how far you've come from that first cell. Onward to Analysis. 📊