Sun. Oct 19th, 2025

🧭 Introduction: The Hidden Structure in Your Data

Ever looked at something like this?

INV-2025-001
SKU-UK-999
EMP-007-JS

Those strings look random β€” but they’re actually structured data.
Each part has meaning: type, year, region, ID.

With Excel’s LEFT(), MID(), and RIGHT() functions, you can slice out any piece automatically β€” no text-to-columns, no Power Query, no VBA.


πŸ’‘ The Three Text Extraction Functions

FunctionWhat It DoesExample
LEFT(text, num_chars)Extracts text from the start=LEFT(A2,3) β†’ INV
MID(text, start_num, num_chars)Extracts text from anywhere=MID(A2,5,4) β†’ 2025
RIGHT(text, num_chars)Extracts text from the end=RIGHT(A2,3) β†’ 001

They work like scissors β€” cutting your text exactly where you tell Excel to.


πŸ”Ή Example 1: Extracting Parts of an Invoice Code

Let’s start with this example:

A (Raw Code)FormulaResult
INV-2025-001=LEFT(A2,3)INV
INV-2025-001=MID(A2,5,4)2025
INV-2025-001=RIGHT(A2,3)001

Breakdown:

  • LEFT(A2,3) β†’ first 3 characters (INV).
  • MID(A2,5,4) β†’ start at character 5, extract 4 characters (2025).
  • RIGHT(A2,3) β†’ last 3 characters (001).

βœ… Result: Split cleanly into code, year, and number.


πŸ”Ή Step-by-Step Logic of MID()

=MID(A2,5,4)

ArgumentWhat It MeansIn This Case
textCell to look inA2
start_numCharacter to start from5 (skips β€œINV-”)
num_charsNumber of characters to extract4 (the digits β€œ2025”)

You could even make this dynamic with FIND():

=MID(A2,FIND("-",A2)+1,4)

Now Excel finds the dash instead of assuming β€œ5” β€” works for varying code lengths.


πŸ”Ή Example 2: Extract Region Codes Dynamically

A (SKU)FormulaResult
SKU-UK-999=MID(A2,FIND("-",A2)+1,2)UK

Explanation:

  1. FIND(“-“,A2) β†’ position of first dash (4)
  2. Add 1 β†’ start at character 5
  3. Extract 2 characters β†’ β€œUK”

βœ… Output: UK


πŸ”Ή Example 3: Extract Last Digits from Employee Codes

CodeFormulaResult
EMP-007-JS=RIGHT(A2,2)JS

Simple and powerful β€” RIGHT cuts from the end, no matter how long the text.


⚑ Dynamic Extraction Using FIND + LEN

When your codes vary in length, hardcoding (like =MID(A2,5,4)) can break.
Use FIND() and LEN() to make it flexible:

=MID(A2,FIND("-",A2)+1,FIND("-",A2,FIND("-",A2)+1)-FIND("-",A2)-1)

This monster formula finds both dashes and extracts whatever is between them β€” whether it’s 2 letters or 5 digits.

βœ… Perfect for mixed data like INV-2025-001 or SKU-USA-98765.


🧠 Pro Analyst Trick β€” Combine with VALUE()

If you extract numbers (like 2025) and plan to calculate with them:

=VALUE(MID(A2,5,4))

That converts the text β€œ2025” into a real number you can use in formulas or charts.


βš™οΈ Common Mistakes

ProblemCauseFix
Wrong characters extractedMiscounted start/lengthUse FIND() to locate exact position
Formula errors (#VALUE!)Dash or symbol not presentWrap in IFERROR()
Numbers not calculatingStill textWrap with VALUE()
Mixed-length codesHardcoded start/lengthUse FIND + LEN combo

πŸ“Š Copy-Paste Excel Demo Table

A (Raw Data)TaskFormulaExpected Result
INV-2025-001Extract Prefix=LEFT(A2,3)INV
INV-2025-001Extract Year=MID(A2,5,4)2025
INV-2025-001Extract Suffix=RIGHT(A2,3)001
SKU-UK-999Extract Region=MID(A3,FIND("-",A3)+1,2)UK
EMP-007-JSExtract Last Letters=RIGHT(A4,2)JS

❀️ Support XL4MULA β€” Free Learning, Powered by You

At XL4MULA, every video, sheet, and post is made to save you time β€” and teach Excel in plain English.

If this guide helped you, consider supporting future content with a voluntary donation. It keeps the tutorials free for everyone who’s learning.

πŸ‘‰ Visit XL4MULA.com to:

  • Watch the 60-second LEFT/MID/RIGHT video πŸŽ₯
  • Download the sample Excel sheet
  • Explore all 20 Excel Cleaning Shorts
  • And, if you’d like, leave a small donation ❀️

βœ… Takeaway

FunctionThink of It AsUse It For
LEFTFrom the startPrefixes, codes, names
MIDFrom the middleYears, IDs, categories
RIGHTFrom the endSuffixes, region codes

Together, they’re Excel’s text extraction trio β€” clean, fast, and perfect for automating structured data cleanup.