Text Extraction and Search

Back

Loading concept...

🔤 Text Functions: Your Text Surgery Toolkit

Imagine you have a magic pair of scissors and a magnifying glass. With these tools, you can cut out any part of a word, find hidden letters, and swap one thing for another—all without getting your hands dirty!

That’s exactly what Excel’s Text Functions do. They’re your toolkit for slicing, searching, and swapping text. Let’s meet each tool!


📏 The LEN Function: Counting Letters

What is it?

LEN counts how many characters are in a piece of text. Every letter, number, space, and symbol counts!

Think of it like…

Counting beads on a necklace. Each bead = one character.

The Formula

=LEN(text)

Example

Cell A1 Formula Result
Hello =LEN(A1) 5
Hello World =LEN(A1) 11

Notice: The space between “Hello” and “World” counts as 1 character too!

Real Life Use

  • Check if a password is long enough
  • Verify ID numbers have correct length
  • Count characters in tweets

✂️ The LEFT Function: Grab from the Start

What is it?

LEFT grabs characters starting from the left side (the beginning).

Think of it like…

Taking the first few cookies from a row. You always start from the left!

The Formula

=LEFT(text, num_chars)

Example

Cell A1 Formula Result
ABCDEFG =LEFT(A1, 3) ABC
John Smith =LEFT(A1, 4) John

Real Life Use

  • Extract area codes from phone numbers
  • Get first name from full name
  • Pull year from date text

✂️ The RIGHT Function: Grab from the End

What is it?

RIGHT grabs characters starting from the right side (the end).

Think of it like…

Taking cookies from the end of the row. You start from the right!

The Formula

=RIGHT(text, num_chars)

Example

Cell A1 Formula Result
ABCDEFG =RIGHT(A1, 3) EFG
John Smith =RIGHT(A1, 5) Smith

Real Life Use

  • Get last 4 digits of credit card
  • Extract file extension (.pdf, .xlsx)
  • Pull last name from full name

✂️ The MID Function: Grab from Anywhere!

What is it?

MID is the superstar. It can grab characters from any position in the text.

Think of it like…

Picking cookies from the middle of the row. You choose where to start and how many to take!

The Formula

=MID(text, start_num, num_chars)

start_num = Which position to start (1 = first character)

Example

Cell A1 Formula Result
ABCDEFG =MID(A1, 3, 2) CD
555-123-4567 =MID(A1, 5, 3) 123

Real Life Use

  • Extract middle name
  • Get specific part of product code
  • Pull data from fixed-format strings

🔍 The FIND Function: Locate Text (Case Sensitive!)

What is it?

FIND tells you where a piece of text appears. It gives you the position number.

Think of it like…

A detective with a magnifying glass who is VERY picky. “A” and “a” are different suspects!

The Formula

=FIND(find_text, within_text)

Example

Cell A1 Formula Result
Hello World =FIND(“o”, A1) 5
Hello World =FIND(“W”, A1) 7
Hello World =FIND(“w”, A1) ERROR!

Remember: FIND is case-sensitive. Uppercase W ≠ lowercase w

Real Life Use

  • Find where “@” appears in email
  • Locate hyphen in phone numbers
  • Check if specific text exists

🔍 The SEARCH Function: Locate Text (Flexible!)

What is it?

SEARCH works like FIND, but it doesn’t care about uppercase or lowercase. It also allows wildcards!

Think of it like…

A friendly detective who says “Close enough!” when looking for suspects.

The Formula

=SEARCH(find_text, within_text)

Example

Cell A1 Formula Result
Hello World =SEARCH(“w”, A1) 7
Hello World =SEARCH(“W”, A1) 7

Both work! SEARCH treats “w” and “W” the same.

FIND vs SEARCH Quick Compare

Feature FIND SEARCH
Case sensitive ✅ Yes ❌ No
Wildcards allowed ❌ No ✅ Yes
Speed Faster Slightly slower

🃏 Wildcard Characters: The Mystery Symbols

What are they?

Wildcards are placeholder symbols that match unknown characters. Use them with SEARCH!

The Three Wildcards

Symbol Meaning Example
? Any single character “c?t” matches cat, cot, cut
* Any number of characters “c*t” matches cat, cart, coconut
~ Escape (find actual ? or *) “what~?” finds “what?”

Examples in Action

Finding “c?t” pattern:

  • ✅ Matches: cat, cot, cut
  • ❌ Doesn’t match: cart, coat

Finding “c*t” pattern:

  • ✅ Matches: cat, cart, coat, coconut
  • ❌ Doesn’t match: car, cater

Real Life Use

  • Find emails ending with any domain
  • Search for product codes with variable parts
  • Locate files with partial names

🔄 The SUBSTITUTE Function: Swap Text

What is it?

SUBSTITUTE finds text and replaces it with something else.

Think of it like…

A teacher correcting spelling. Find the mistake, swap in the fix!

The Formula

=SUBSTITUTE(text, old_text, new_text)

Example

Cell A1 Formula Result
Hello World =SUBSTITUTE(A1, “World”, “Excel”) Hello Excel
555-123-4567 =SUBSTITUTE(A1, “-”, “”) 5551234567

Advanced: Replace Specific Occurrence

Add a 4th parameter to replace only the 1st, 2nd, or 3rd occurrence:

=SUBSTITUTE(text, old, new, instance_num)
Cell A1 Formula Result
a-b-c-d =SUBSTITUTE(A1, “-”, “.”, 2) a-b.c-d

Only the 2nd hyphen became a dot!

Real Life Use

  • Remove unwanted characters
  • Fix formatting issues
  • Clean up data imports

🎯 Combining Functions: Power Moves!

The real magic happens when you combine these functions!

Example 1: Extract First Name

=LEFT(A1, FIND(" ", A1) - 1)

This finds the space, then takes everything before it!

Example 2: Extract Last Name

=RIGHT(A1, LEN(A1) - FIND(" ", A1))

This calculates how many characters come after the space!

Example 3: Extract Domain from Email

=MID(A1, FIND("@", A1) + 1, 100)

Find @, start after it, grab plenty of characters!


🧠 Quick Memory Guide

graph TD A["Text Functions"] --> B["Measure"] A --> C["Extract"] A --> D["Search"] A --> E["Replace"] B --> B1["LEN - Count characters"] C --> C1["LEFT - From start"] C --> C2["RIGHT - From end"] C --> C3["MID - From anywhere"] D --> D1["FIND - Case sensitive"] D --> D2["SEARCH - Flexible"] D --> D3["Wildcards: ? * ~"] E --> E1["SUBSTITUTE - Swap text"]

🏆 You Did It!

You now have a complete toolkit for text surgery in Excel:

Function What It Does
LEN Counts all characters
LEFT Grabs from the beginning
RIGHT Grabs from the end
MID Grabs from any position
FIND Locates text (exact match)
SEARCH Locates text (flexible)
Wildcards Match unknown characters
SUBSTITUTE Swaps text

Remember: These functions work on text values. Numbers work too, but Excel treats them as text when you use these functions!

Now go slice, search, and swap your data like a pro! 🚀

Loading story...

Story - Premium Content

Please sign in to view this story and start learning.

Upgrade to Premium to unlock full access to all stories.

Stay Tuned!

Story is coming soon.

Story Preview

Story - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.