How to Extract Last Two Words From Cell in Excel
Learn multiple Excel methods to extract last two words from cell with step-by-step examples, troubleshooting tips, and best practices for every Excel version.
How to Extract Last Two Words From Cell in Excel
Why This Task Matters in Excel
Extracting the last two words from a text string seems like a small trick, yet it unlocks enormous value in everyday data work. Imagine a sales database where the product column holds full product names such as “Laptop Carry Bag Large” and you need only the sub-category “Bag Large.” Or consider HR data where employee job titles like “Senior Financial Analyst” must be shortened to “Financial Analyst” for concise reporting and pivot-table grouping. In marketing lists you may have webinar titles such as “Excel Power Query Masterclass – Live Session,” but dashboards require just “Live Session” for concise labelling. Customer-service teams frequently log cases that begin with identifiers like “CASE-10432 Mobile App Crash Report,” and managers want only “Crash Report” in performance metrics. Each situation calls for a fast, accurate way to isolate the final two words.
Excel is perfectly suited to this extraction because its text functions are lightweight, instantly recalculate when data changes, and integrate seamlessly with lookups, charts, and pivot tables. Unlike manual splitting or ad-hoc text editors, formulas guarantee consistency across thousands of rows while eliminating human error. Beyond analytical convenience, mastering this technique deepens your understanding of string handling, array manipulation, and dynamic ranges—skills that translate directly to data cleaning, transformation, and automation tasks.
Failing to extract text properly can have tangible consequences. Poorly parsed product names break lookups, inflate pivot-table categories, and skew KPI calculations. In regulated industries, inaccurate titles in compliance reports can cause audit flags. Time wasted on manual edits drains productivity and introduces risk. Knowing reliable approaches also connects to broader workflows: filtered lists, advanced functions like TEXTSPLIT, and power-user features such as Power Query all depend on solid text-extraction fundamentals. By the end of this tutorial you will confidently handle any “last-two-words” scenario, regardless of Excel version or data complexity.
Best Excel Approach
The optimal method depends on your Excel edition. For Microsoft 365 or Excel 2021 users, dynamic array functions make the task almost trivial. The combination of TEXTSPLIT, TAKE, and TEXTJOIN delivers a transparent, flexible, and reusable formula.
=TEXTJOIN(" ",,TAKE(TEXTSPLIT(A2," "),-2))
Why this method is best:
- Dynamic arrays automatically spill results without helper columns.
- The formula is short, readable, and adapts to strings of any length.
- It handles multiple consecutive spaces because
TEXTSPLITcollapses delimiters by default. TAKEwith a negative argument elegantly returns the last n elements—in this case, the last two words.- If the cell contains fewer than two words,
TAKEsimply returns whatever is available, avoiding #VALUE! errors.
Older versions (Excel 2019 and earlier) lack these functions. A robust legacy formula uses SUBSTITUTE, REPT, LEN, and TRIM to simulate the effect:
=TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),2*LEN(A2)))
SUBSTITUTEswaps each space with a large block of spaces.RIGHTextracts a chunk big enough to include the final two words.TRIMremoves excess spaces, leaving precisely the last two words.- The multiplier
2*LEN(A2)guarantees the block is always large enough for any string in A2.
When to use which:
- Microsoft 365 / 2021: dynamic array formula—cleaner and faster.
- Excel 2019 or earlier: legacy substitute/right formula—compatible with every workbook.
Prerequisites: cells must contain text separated by single spaces (or at least consistent delimiters). Non-text (numbers, blanks) should be converted or handled withIFERROR.
Parameters and Inputs
Input cell: Any text string in a single cell, typically referenced as A2 in examples.
Data type: General or Text. Numbers formatted as text are acceptable, but dates require TEXT conversion first.
Delimiter: By default, a single space. If words are separated by hyphens or underscores, replace \" \" in the formula with the desired delimiter.
Word count: Formulas automatically adapt to strings shorter than two words—no error is thrown; only available words appear.
Data preparation: Remove leading, trailing, or multiple consecutive spaces if you use legacy formulas. Dynamic array methods handle consecutive spaces, but trimming beforehand is still good practice.
Validation: Use ISTEXT(A2) to confirm textual input when processing mixed data columns.
Edge cases: Cells with line breaks require substituting CHAR(10) for the delimiter; cells with punctuation at the end may need SUBSTITUTE(A2,".","") to strip periods.
Step-by-Step Examples
Example 1: Basic Scenario
You have a simple product list:
| Column A (Product Description) |
|---|
| Wireless Mouse Compact Black |
| USB Flash Drive 32GB |
| Office Chair Mesh Back |
| Stapler Metal Heavy Duty |
Goal: return only the last two words in column B.
- Place your cursor in B2.
- Enter the dynamic array formula (Excel 365/2021):
=TEXTJOIN(" ",,TAKE(TEXTSPLIT(A2," "),-2))
- Press Enter. The result spills automatically to display “Compact Black” in B2.
- Copy or drag the formula down to B5. Excel adjusts the A-row reference each time, outputting “32GB,” “Mesh Back,” and “Heavy Duty.”
Why it works:
TEXTSPLIT(A2," ")breaks “Wireless Mouse Compact Black” into [\"Wireless\",\"Mouse\",\"Compact\",\"Black\"].TAKE(...,-2)returns [\"Compact\",\"Black\"].TEXTJOIN(" ",, ...)concatenates the pieces with a single space.
Common variations:
- If your delimiter is a hyphen, edit
TEXTSPLIT(A2,"-"). - To show the result in uppercase, wrap with
UPPER().
Troubleshooting: If you see a spill error (#SPILL!), ensure no other content blocks the spill range. If a #NAME? error appears, your Excel version likely lacksTEXTSPLIT—use the legacy formula instead.
Example 2: Real-World Application
Scenario: An HR specialist manages a table with 2 000 job titles like “Director of Business Development,” “Assistant Vice President Marketing,” and “Lead UX Designer.” The dashboard’s chart labels can’t fit long titles, so management requests only the last two words.
Data layout:
| A (Employee) | B (Job Title) |
|---|---|
| 1001 | Director of Business Development |
| 1002 | Assistant Vice President Marketing |
| 1003 | Lead UX Designer |
| … | … |
Steps:
- Insert a new helper column C named “Short title.”
- In C2, input the legacy-compatible formula for company machines still running Excel 2016:
=TRIM(RIGHT(SUBSTITUTE(B2," ",REPT(" ",LEN(B2))),2*LEN(B2)))
- Double-click the fill handle to copy the formula through all 2 000 rows.
- Add this column to your pivot table’s Row Labels field. The pivot now groups employees under concise titles like “Business Development,” “Vice President Marketing,” and “UX Designer.”
Business benefit: The report is readable, fits conference screens, and auto-updates as HR inputs new roles.
Integration: The short title can be used in VLOOKUP or XLOOKUP for cross-sheet analytics, or as a slicer in dashboards.
Performance: Even on large lists, the formula recalculates instantly because it relies only on simple text functions. Avoid volatile functions that recalculate on every action.
Example 3: Advanced Technique
Scenario: You receive a CSV export of customer feedback where the comment field begins with a time stamp and ends with severity words like “High Priority,” “Medium Concern,” or “Low Risk.” The format is inconsistent: some messages have extra spaces, and others contain line breaks. You need a clean “Severity” column to drive conditional formatting and KPI alerts.
Data snapshot with messy cell in A2:
\"2023-09-15 14:02:05 – User reports screen flicker
High Priority\"
Challenges:
- Line break between message and severity.
- Extra spaces before severity.
- Older Excel version in the operations department.
Solution steps:
- Normalize the line breaks. In B2, create a cleaned version:
=TRIM(SUBSTITUTE(A2,CHAR(10)," "))
- Extract last two words in C2 with a slightly modified legacy formula referencing the cleaned string:
=TRIM(RIGHT(SUBSTITUTE(B2," ",REPT(" ",LEN(B2))),2*LEN(B2)))
- Convert severity text to standardized upper case for uniformity:
=UPPER(C2)
- Apply conditional formatting to highlight rows where severity equals \"HIGH PRIORITY.\"
Edge-case handling:
- If a comment ends with only one severity word (rare “Critical”), the formula still returns it.
- To catch blank severities, wrap with
IF(LEN(C2)=0,"UNSPECIFIED",C2).
Performance optimization: Cleaning in a helper column (B) avoids repeating expensiveSUBSTITUTEwithin the main extraction formula, improving recalc speed on 50 000-row datasets.
Tips and Best Practices
- Prefer dynamic array functions (
TEXTSPLIT,TAKE,TEXTJOIN) when available—they are easier to read and maintain. - Store delimiter characters in a dedicated cell (e.g., Settings!A1) and reference it to adapt formulas when data sources change.
- Use named ranges like
LastTwoWordsfor formulas to keep dashboards self-documenting and reduce risk during edits. - When processing massive lists, turn on Manual Calculation and press F9 only after all formulas are entered to avoid repeated recalc lag.
- Combine extraction formulas with data validation lists to ensure downstream fields (e.g., Severity) allow only expected categories.
- Document assumptions—such as “space is the delimiter” or “title ends with two English words”—in a hidden worksheet for future maintainers.
Common Mistakes to Avoid
- Forgetting to wrap legacy formulas in
TRIM(), which leaves padded spaces and breaks comparisons. Fix by addingTRIMor usingCLEANwhen importing from web or SQL sources with hidden characters. - Hard-coding word counts (using RIGHT with a fixed number of characters) instead of calculating dynamically, causing truncation when words vary in length. Detect this by comparing source and result lengths; correct by switching to the
SUBSTITUTEpattern. - Over-relying on Flash Fill, which does not update automatically when new data arrives. If real-time accuracy is essential, replace Flash Fill with formulas.
- Misidentifying delimiters—copying formulas that split on spaces when the data uses tabs or non-breaking spaces. Test with
LENandLEN(SUBSTITUTE())to verify. - Pasting values over the formula area while editing, thus breaking dynamic spill ranges and losing automation. Preserve a clean version of the sheet and use “Paste Values” only after duplicating the column.
Alternative Methods
Below is a comparison of three mainstream approaches:
| Method | Excel Version | Readability | Performance on 20 000 rows | Handles variable delimiters | Auto-updates |
|---|---|---|---|---|---|
TEXTSPLIT + TAKE + TEXTJOIN | 365 / 2021 | Very high | Excellent (less than 1 second) | Yes | Yes |
SUBSTITUTE + RIGHT + TRIM | All | Moderate | Good (1-3 seconds) | Yes | Yes |
| Power Query Split Column & Keep Last 2 | 2010+ with add-in | High (UI) | Good (depends on load/refresh) | Yes | Requires refresh |
Power Query steps: Home ▶ Transform ▶ Split Column ▶ By Delimiter ▶ Space ▶ Split into rows ▶ Keep bottom 2 ▶ Group & re-combine. Advantages: graphical interface, no formulas; sidesteps Excel’s 1 048 576-row limit by loading into the data model. Disadvantages: requires Refresh, slightly slower for small sheets, adds query overhead.
When to use:
- Use dynamic array formulas for ad-hoc analysis or dashboard visuals.
- Choose Power Query when you’re already ETL-ing data or need to append multiple files.
- Stick to legacy formulas in shared workbooks where colleagues run older Excel.
FAQ
When should I use this approach?
Whenever you need to isolate the final two tokens of a text string for reporting, grouping, or clean display—especially in product catalogs, job titles, or compliance labels.
Can this work across multiple sheets?
Yes. Point TEXTSPLIT(Sheet2!A2," ") or supply a 3D reference in legacy formulas. Ensure both worksheets follow the same delimiter convention.
What are the limitations?
If the delimiter occurs within a word (e.g., names like “A-Level”), splitting on the hyphen may break intended words. Also, formulas assume words do not include trailing punctuation unless cleaned first.
How do I handle errors?
Wrap formulas in IFERROR to return blank or custom text:
=IFERROR(TEXTJOIN(" ",,TAKE(TEXTSPLIT(A2," "),-2)),"Missing")
In legacy versions, IFERROR() is available from Excel 2007 onward; in older releases use IF(ISERROR(...),...,...).
Does this work in older Excel versions?
Yes. The SUBSTITUTE + RIGHT + TRIM formula is compatible back to Excel 2003. Arrays spill only in 365+, so copy the formula down manually in earlier versions.
What about performance with large datasets?
Dynamic arrays and legacy text functions are lightweight; bottlenecks are rare until hundreds of thousands of rows. Disable automatic calculation while entering formulas, use helper columns for heavy SUBSTITUTE, and consider Power Query for million-row imports.
Conclusion
Extracting the last two words from a cell is a deceptively powerful skill that streamlines reporting, boosts lookup accuracy, and refines dashboards. You now know modern dynamic-array techniques, backward-compatible formulas, and GUI-based Power Query workflows. Mastering this small text-manipulation pattern expands your overall Excel proficiency and prepares you for advanced string parsing, data cleansing, and automation tasks. Keep experimenting with different delimiters, combine techniques with other functions like FILTER or XLOOKUP, and integrate them into your daily data routines for maximum productivity.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.