How to Extract the First Few Words from a Cell in Excel
Question details
The user needs a method or formula to extract a specific number of words from the beginning of a text string within a single cell.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Processing text data where only the first few words are relevant, such as pulling first and middle names, or isolating introductory keywords from a longer phrase.
- Observed behavior
- Looking to isolate and extract the first two or more words from a continuous text string inside a cell without manually copying, pasting, or using text-to-columns.
Determine exactly how many words you need to extract and ensure your text cells are separated by standard single spaces before applying the formulas.
Extract Words Using TRIM, LEFT, SUBSTITUTE, and REPT Formulas
This classic nested formula works across all versions of Excel to isolate and extract a specific number of words from a longer text string.
This method uses a combination of functions to manipulate the spaces between words. The REPT function creates a large gap of spaces, SUBSTITUTE replaces normal spaces with these large gaps, LEFT grabs the beginning chunk of the text, and TRIM cleans up any leftover trailing spaces.
Click on an empty cell where you want the extracted words to be displayed.
Type the formula: =TRIM(LEFT(SUBSTITUTE(C6," ",REPT(" ",100)),200)). Replace 'C6' with the reference to the cell containing your source text.
Press Enter to see the result. If you have a column of data, click the small square at the bottom-right corner of the cell and drag it down to fill the formula for the remaining rows.

Extract Words Using the TEXTBEFORE Function
If you are using a newer version of Excel (Microsoft 365 or Excel 2021), you can use a much simpler function designed specifically for this task.
Easily Extract Text and Manage Data with WPS Spreadsheet
WPS Spreadsheet fully supports advanced text manipulation formulas like TRIM, LEFT, SUBSTITUTE, and more. You can easily process text data, clean up messy cells, and organize your spreadsheets with its comprehensive set of built-in functions.
- 1. Open your file: Launch WPS Spreadsheet and open the document containing your text data.
- 2. Select the target cell: Click on the blank cell where you want the extracted words to appear.
- 3. Input the formula: Type your preferred formula, such as =TRIM(LEFT(SUBSTITUTE(C6," ",REPT(" ",100)),200)), and press Enter.
- 4. Auto-fill the column: Drag the fill handle down to apply the exact same text extraction logic to the rest of your list.

Frequently Asked Questions
Can I extract the last few words instead of the first?
Yes. You can use a similar nested formula using RIGHT instead of LEFT. The logic involves using SUBSTITUTE to create large gaps, and then RIGHT to extract a chunk of text from the end before using TRIM to clean it up.
Why is my formula returning extra spaces or miscounting words?
This usually happens if your original text has double spaces or leading spaces. You can wrap your initial cell reference in a TRIM function, such as SUBSTITUTE(TRIM(C6)," ",...), to ensure uniform single spaces before the main formula processes it.
Does this formula work if words are separated by commas?
If your text uses commas instead of spaces as separators, you simply need to change the delimiter in the SUBSTITUTE or TEXTBEFORE function. Replace the space " " with a comma "," in your formula.
What is the simplest way to extract only the very first word?
To extract just the first word, you don't need the REPT function. You can use a shorter formula: =LEFT(C6, FIND(" ", C6) - 1), which locates the first space and extracts all characters before it.




