Ravindra BagaleCourses & study guides Track your progress

Excel TEXTBEFORE Function

Chala mitrano — tEXTBEFORE keeps the part before a marker. Email before @, SKU before dash — clear and modern.

Fictional sample data for learning. Email and SKU parsing (Kochi support + Amsterdam marketplace). Mixed ₹ and €.

Purpose

Return the text that sits before a given delimiter — modern, readable parsing on Microsoft 365 / Excel 2021.

Return value

Text before the delimiter, or #N/A if the delimiter is missing (unless you set if_not_found).

Syntax

TEXTBEFORE(text, delimiter, [instance_num], [match_mode], [match_end], [if_not_found])

Arguments

ArgumentRequired?Description
textRequiredFull text.
delimiterRequiredThe marker to cut before.
instance_numOptionalWhich delimiter (default 1; negative counts from end).
match_modeOptional0 case-sensitive (default), 1 case-insensitive.
match_endOptionalTreat end of text as delimiter if needed.
if_not_foundOptionalValue when delimiter is missing.

Version

Microsoft 365 and Excel 2021. Not in Excel 2019 or older. LibreOffice: usually missing — use LEFT+FIND fallback.

How to use — Why → What → How

Why: Kochi support wants the name part of emails. Amsterdam marketplace SKUs look like ACE-4412 and need the brand before the dash. TEXTBEFORE reads cleaner than LEFT+FIND. Modern first, fallback second: TEXTBEFORE on 365, LEFT+FIND on 2019. Ship both in the practice workbook so home PCs still work.

What: TEXTBEFORE returns everything before the chosen delimiter instance. Older Excel users should fall back to LEFT(FIND()-1). Read every argument in the table once before you type; each one changes the answer on purpose.

How — numbered steps:

  1. Type =TEXTBEFORE(A2,"@").
  2. Add if_not_found as the last argument you need.
  3. Use instance_num -1 for before the last delimiter.
  4. On Excel 2019, write =LEFT(A2,FIND("@",A2)-1).
  5. Verify with a few messy rows.

Ravindra Bagale's Tip

Friends, always set if_not_found for messy data so reports do not show #N/A.

Ravindra Bagale's Tip

Friends, sleep on TEXTBEFORE and rebuild example 1 tomorrow without looking. That five-minute test beats rereading the whole page.

Ravindra Bagale's Tip

Friends, after you finish TEXTBEFORE, open yesterday’s real workbook and find one place this function would have saved ten minutes. That habit turns lessons into salary skills.

Download practice file: practice-textbefore.xlsx (includes sheet About this data, practice sheets, and Answers).

Worked examples

1) Email name

Kochi.

Email
neha@demo.in
omar.khan@firm.com
Formula: =TEXTBEFORE(A2,"@")

Result: neha

What it means: Local part of email.

2) Brand before dash

Amsterdam.

SKUPrice (€)
ACE-441212.5
BOL-22019.9
Formula: =TEXTBEFORE(A2,"-")

Result: ACE

What it means: Brand ACE.

3) if_not_found

Missing @.

Email
not-an-email
Formula: =TEXTBEFORE(A2,"@",,,,,"No @")

Result: No @

What it means: Friendly fallback.

4) Before last dash

Multi-dash.

ID
INV-PUNE-7781
Formula: =TEXTBEFORE(A2,"-",-1)

Result: INV-PUNE

What it means: Everything before the last dash.

5) Fallback formula

Excel 2019 style.

Email
neha@demo.in
Formula: =LEFT(A2,FIND("@",A2)-1)

Result: neha

What it means: Same idea without TEXTBEFORE.

6) Case mode

Insensitive delimiter rare.

Code
abXcd
Formula: =TEXTBEFORE(A2,"x",,1)

Result: ab

What it means: match_mode 1 ignores case of x/X.

Common errors and fixes

#N/A — Delimiter missing and no if_not_found. Fix: Set if_not_found.
#NAME? — Excel version too old. Fix: Use LEFT+FIND fallback.

Notes and tips

  • 365/2021 only for TEXTBEFORE itself.
  • Negative instance_num counts from the end.
  • Practice workbook includes LEFT+FIND fallback sheet for LibreOffice.
  • Modern Excel classes in Kochi and Amsterdam should learn TEXTBEFORE first, then the LEFT+FIND fallback for company PCs still on Excel 2019.
  • TEXTBEFORE vs LEFT+FIND: same job; TEXTBEFORE is readable. vs TEXTAFTER: opposite side of the delimiter.
  • Fictional sample data only — practice amounts and names are made for learning.
  • After the 10 tasks, re-read the errors table once.
  • Say the business question in plain words before you type equals.
  • Keep a scrap sheet for experiments so you do not overwrite class files.
  • Fill formulas down only after the first row looks correct.
  • When two answers look possible, write both on paper then test in Excel.
  • Modern first, fallback second: TEXTBEFORE on 365, LEFT+FIND on 2019. Ship both in the practice workbook so home PCs still work.
  • Revisit the TEXTBEFORE errors table after the quiz — most classroom mistakes are listed there.
  • Build one brand-new example on a blank sheet from memory before you close the laptop.
  • If a result looks wrong, check spaces with LEN and case with exact equals before changing the formula.
  • Share one tip from this page with a classmate in Marathi or Hindi — teaching locks the idea.
  • Keep currency symbols consistent inside a single report column even when practice mixes ₹ $ £ € across examples.
  • When Excel versions differ at home and in class, write the fallback formula under the modern one in a comment cell.
  • Print the revision card for TEXTBEFORE and stick it near your monitor for one week of real worksheets.
  • When helping a junior, ask them to predict the result before pressing Enter — prediction builds judgement.
  • Keep a personal notebook of the one mistake you make most often with this function; review it monthly.

In real work

Modern Excel classes in Kochi and Amsterdam should learn TEXTBEFORE first, then the LEFT+FIND fallback for company PCs still on Excel 2019. Modern first, fallback second: TEXTBEFORE on 365, LEFT+FIND on 2019. Ship both in the practice workbook so home PCs still work. Classroom drill: write three brand-new TEXTBEFORE formulas on a blank sheet using names from your own city — if you can invent them without the page open, you own the skill. Then break one formula on purpose (wrong case, wrong start, extra space) and watch the error; recovering from that break is half of interview readiness.

How it compares

TEXTBEFORE vs LEFT+FIND: same job; TEXTBEFORE is readable. vs TEXTAFTER: opposite side of the delimiter.

Interview corner

Excel 2019 alternative?
LEFT with FIND.
Before last delimiter?
instance_num -1.
Missing delimiter?
if_not_found or #N/A.

TEXTAFTER, TEXTSPLIT, LEFT, FIND

Practice tasks (10)

  1. Task 1. Name from neha@demo.in.
    Hint: delimiter @.
  2. Task 2. Brand from ACE-4412.
    Hint: dash.
  3. Task 3. if_not_found demo.
    Hint: last argument idea.
  4. Task 4. Before last dash on INV-PUNE-7781.
    Hint: -1.
  5. Task 5. Write LEFT+FIND fallback.
    Hint: Excel 2019.
  6. Task 6. Fill two emails.
    Hint: fill down.
  7. Task 7. Note version requirement.
    Hint: 365/2021.
  8. Task 8. Compare to TEXTAFTER.
    Hint: other side.
  9. Task 9. LibreOffice plan.
    Hint: fallback sheet.
  10. Task 10. Interview: instance -1?
    Hint: from end.

Quick quiz

Q1. TEXTBEFORE("neha@demo.in","@") returns:
Q2. Needs roughly:
Q3. Fallback:
Q4. Before last dash:
Q5. Missing delimiter without if_not_found:

Answers: Q1=neha, Q2=Microsoft 365/2021, Q3=LEFT+FIND, Q4=instance_num -1, Q5=#N/A (check after you try).

Revision card

Standalone card (no tip or photo strip). QR opens this lesson. Download the PNG and revise offline.

Revision card: TEXTBEFORE
TEXTBEFORE revision card