Excel Guide · Prompt: “Keep only the text before the first hyphen "-" in each SKU code in column A”
Remove Everything After a Character in Excel (LEFT + FIND)
Verified by LiveFormulaLab Engineering Team • Updated November 2026
Strip suffixes, query parameters, or tags after a hyphen, slash, or @ symbol in Excel using LEFT and FIND. Copy and test the formula live.
Verified Excel Syntax
=IFERROR(LEFT(A2, FIND("-", A2) - 1), A2)How This Formula Works (Step-by-Step)
When SKU codes, URLs, or product names contain trailing tags after a delimiter, combine LEFT and FIND to slice everything before the character.
Step 1: FIND("-", A2) locates the position of the first hyphen.
Step 2: Subtract 1 so the hyphen itself is excluded, and wrap with IFERROR so strings without hyphens remain intact.
Formula Syntax & Arguments Breakdown
Uses FIND to locate the first occurrence of a delimiter character and passes position minus 1 into LEFT, guarded by IFERROR when the delimiter does not exist.
| Argument / Clause | Requirement | Data Type | Role & Behavior |
|---|---|---|---|
text (A2) | Required | Text Cell | Input string containing a prefix followed by a delimiter and suffix (e.g., "SKU-4821-US"). |
delimiter ("-") | Required | Character / String | Character marking where truncation begins; everything from this character rightward is stripped. |
value_if_error (A2) | Required | Fallback Cell / Text | Returns the original untouched cell value whenever the delimiter does not appear in the string. |
3 Real-World Use Cases
- Extracting base product families from variant SKUs like "SHIRT-BLK-LG".
- Stripping UTM query strings after "?" from marketing landing page URLs.
- Removing parenthetical notes like "(Legacy)" from imported CRM account names.
Cross-Platform Equivalents
- Excel
=IFERROR(LEFT(A2, FIND("-", A2)-1), A2)- SQL
SELECT SPLIT_PART(full_sku, '-', 1) AS base_product FROM inventory;- Python Pandas
df['Base Product'] = df['Full SKU'].str.split('-').str[0]
Common Mistakes & Pro Tips
Pitfalls & How to Fix Them
Mistake: Forgetting to subtract 1 from FIND("-", A2) leaves the trailing hyphen attached to the extracted prefix.
Fix: Always use FIND("-", A2) - 1 inside LEFT so the delimiter itself is excluded.
Mistake: Omitting IFERROR produces #VALUE! on clean rows that lack the delimiter entirely.
Fix: Wrap the extraction in IFERROR(..., A2) so delimiter-free rows pass through safely.
Mistake: Using FIND when your delimiter is a letter that changes case (e.g., "x" vs "X") causes missed splits.
Fix: Switch from case-sensitive FIND to case-insensitive SEARCH when splitting by alphabetic markers.
Engineering Pro Tips
- In Excel 365, =TEXTBEFORE(A2, "-", 1, 0, 0, A2) removes text after the first hyphen cleanly and handles missing delimiters natively.
- To strip everything after the LAST hyphen instead of the first, use =TEXTBEFORE(A2, "-", -1).
- Wrap the output in TRIM() if spaces precede the delimiter (such as "Northstar - Enterprise").
Frequently Asked Questions
- What if some rows do not contain the delimiter character?
- Wrapping the expression in IFERROR(..., A2) returns the original string unchanged instead of #VALUE!.
- Is FIND case-sensitive?
- Yes, FIND is case-sensitive. Use SEARCH instead of FIND when matching letters case-insensitively.
- Can Excel 365 do this more simply?
- Yes: =TEXTBEFORE(A2, "-", 1, 0, 1, A2).
Related Formulas & Guides
- Count Unique Values with Criteria in Excel — Count distinct customers, orders, or IDs that match a condition in Excel without pivot tables. Interactive sandbox included.
- Calculate Business Days Between Two Dates in Excel — Compute working days between two dates in Excel excluding weekends and holidays with NETWORKDAYS and DATEDIF. Copy and test live.
- Find Conditional Maximum Value in Excel with MAXIFS — Find the largest value matching one or more criteria in Excel using MAXIFS. Copy the formula and compare SQL and Python equivalents.
- Split Full Name Into First and Last Name in Excel — Separate first names and last names cleanly in Excel using LEFT, RIGHT, and FIND. Test the formula live with editable contact rows.