Advanced Excel for Data AnalystsLesson 16 of 49
Lesson 16 of 49

Dynamic Text Finding & Slicing: FIND vs SEARCH with MID

Overview & Learning Objectives

When string lengths vary—such as customer email addresses and full names—hardcoded character counts fail. Combining FIND or SEARCH with MID and LEFT dynamically slices text at specific delimiter characters (like "@" or space " ").

  • Contrast FIND (case-sensitive, no wildcards) with SEARCH (case-insensitive, supports wildcards).
  • Dynamically split First Names and Last Names of varying lengths.
  • Extract email domain names dynamically using FIND and MID.

Industry Standard

Standard: Marketing operations teams routinely sanitize CRM exports using dynamic FIND & MID formulas before syncing leads into Salesforce or HubSpot.

Real-World Example: Customer Relationship Management (CRM) Name & Email Splitting

At GrowthPulse CRM, customer records arrive with mixed emails like `sachin.sharma@datacliq.in` and `ananya@infosys.com`. A dynamic formula extracts the domain name (`datacliq.in`, `infosys.com`) regardless of email length.

Customer EmailDelimiter Position (FIND)Username (LEFT)Domain Name (MID)
sachin.sharma@datacliq.in14=LEFT(A2, FIND("@", A2)-1)=MID(A2, FIND("@", A2)+1, 100)
ananya@infosys.com7ananyainfosys.com
vikram.k@tcs.com9vikram.ktcs.com

Functions Covered in this Chapter

Here is the definition, exact syntax, parameter breakdown, and real-world business example for each function covered in this chapter:

Function 1

FIND Function

Definition: Locates the starting character position of a substring inside a text string (case-sensitive, does not support wildcards).

Syntax:
=FIND(find_text, within_text, [start_num])
Parameters Breakdown:
  • find_text: The character or substring you are searching for (e.g. "@" or " ").
  • within_text: The cell containing the text being searched.
  • [start_num]: Optional character position where search begins (default is 1).
Real-World Example (Locate Delimiter Position):
Problem / Scenario: Find the position of the "@" symbol in "sachin.sharma@datacliq.in".
Formula: =FIND("@", A2)
Result: 14
Why it works: The "@" character is the 14th character in the string.
Function 2

SEARCH Function

Definition: Locates the starting character position of a substring (case-insensitive and supports wildcards * and ?).

Syntax:
=SEARCH(find_text, within_text, [start_num])
Parameters Breakdown:
  • find_text: The substring to locate (supports * for wildcard matching).
  • within_text: The text being evaluated.
Real-World Example (Case-Insensitive Search):
Problem / Scenario: Locate the position of "ltd" in "Tata Motors Ltd" regardless of upper/lower case.
Formula: =SEARCH("ltd", A2)
Result: 13
Why it works: Matches "Ltd" or "LTD" without throwing an error.
Function 3

SUBSTITUTE Function

Definition: Replaces specific occurrences of an existing substring with new text by string value.

Syntax:
=SUBSTITUTE(text, old_text, new_text, [instance_num])
Parameters Breakdown:
  • text: The source string.
  • old_text: The string to be replaced.
  • new_text: The replacement string.
  • [instance_num]: Which occurrence to replace (if omitted, replaces all occurrences).
Real-World Example (Phone Number Standardizer):
Problem / Scenario: Replace all hyphens in "98765-43210" with spaces.
Formula: =SUBSTITUTE("98765-43210", "-", " ")
Result: "98765 43210"
Why it works: Replaces every hyphen in the text with a space.
Function 4

REPLACE Function

Definition: Replaces a specific number of characters inside a text string based on character position numbers.

Syntax:
=REPLACE(old_text, start_num, num_chars, new_text)
Parameters Breakdown:
  • old_text: The source text.
  • start_num: Starting character position.
  • num_chars: How many characters to remove.
  • new_text: Replacement text to insert.
Real-World Example (Mask Sensitive Digits):
Problem / Scenario: Mask the middle 4 digits of a 10-digit mobile number "9876543210" with "XXXX".
Formula: =REPLACE(A2, 4, 4, "XXXX")
Result: "987XXXX210"
Why it works: Replaces 4 characters starting at position 4 with "XXXX".

Common Mistakes & Limitations

  • FIND returns `#VALUE!` if the search text is not found. Always wrap in `IFERROR` or `ISNUMBER` when text might be missing.
  • Using FIND when you need case-insensitive matching; use SEARCH instead.

Keyboard Shortcuts

ActionWindowsMac
Evaluate Formula StepAlt + M + VFormulas Ribbon
Find & Replace DialogCtrl + HCtrl + H

Pro Tips & Modern Alternatives

  • In Excel 365, use `=TEXTBEFORE(A2, "@")` and `=TEXTAFTER(A2, "@")` to eliminate FIND/MID completely.
  • Use Text to Columns with Delimiter = "@" for fast 1-click batch splitting.