Function Problems

How to Return 17 Characters or Text Before the First Space in Excel

Tauseeq MagsiTauseeq Magsi Oct 28, 2026 871 views

Question details

The user needs an Excel formula to extract a maximum of 17 characters from a cell, but wants the extraction to stop earlier if a space character is encountered.

How to Return 17 Characters or Text Before the First Space in Excel
Product
Excel
Device & OS
not provided
Scenario
Extracting specific text fragments from datasets where a string might be shorter than a hard 17-character limit, or where data should naturally split at the first word boundary.
Observed behavior
The user needs a dynamic way to isolate the exact string segment (up to 17 characters or up to the first space) without triggering errors when spaces are absent.
Before you start

Identify the target cell reference containing your original text (e.g., A1) and ensure your dataset uses standard space characters for separation.

Solution 1Recommended

Use a Nested Formula with LEFT, MIN, IFERROR, and FIND

Combine these text and math functions to dynamically handle both constraints: hitting the 17-character limit or encountering a space first.

This formula checks the position of the first space in the text. If a space is found within the first 17 characters, it stops extracting at that point. If no space exists or it appears after 17 characters, it simply returns the first 17 characters without returning an error.

1
Select the target cell

Click on the blank cell where you want the extracted text to be displayed.

2
Enter the extraction formula

Type the formula: =LEFT(A1,MIN(17,IFERROR(FIND(" ",A1)-1,17))). Be sure to replace "A1" with your actual cell reference if your text is located elsewhere.

3
Apply the result

Press the Enter key to calculate the formula.

4
Apply to multiple cells

Click the bottom-right corner of the cell containing the result and drag the fill handle down to apply this logic to other cells in the column.

Use a Nested Formula with LEFT, MIN, IFERROR, and FIND
Formula Breakdown: The FIND function locates the space, MIN determines the smaller number between 17 and the space index, and IFERROR prevents #VALUE! errors if no space is present.
Efficient Data Processing with WPS

Extract Text Flawlessly with WPS Spreadsheet

WPS Spreadsheet fully supports advanced text functions like LEFT, MIN, and FIND, making text manipulation seamless and straightforward.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your text.
  2. 2. Select the output cell: Click on the empty cell where the result should appear.
  3. 3. Input the formula: Type =LEFT(A1,MIN(17,IFERROR(FIND(" ",A1)-1,17))) into the formula bar.
  4. 4. Process the data: Press Enter, then use the drag-fill handle to process bulk data effortlessly across the column.
Fully compatible with Microsoft Excel formulas and file formats (.xlsx).Intuitive formula bar with helpful real-time syntax suggestions.Free, lightweight, and fast-loading office suite.
microsoft office alternative - wps office

Frequently Asked Questions

What happens if the text is shorter than 17 characters and has no spaces?

The formula will safely return the entire text string. The IFERROR function handles the lack of a space, and the MIN function ensures it does not try to extract more characters than are available.

Can I change the character limit from 17 to another number?

Yes. To change the limit, simply replace the number '17' in both places within the formula with your desired maximum character limit.

Why do I get a #VALUE! error when using the FIND function alone?

A #VALUE! error occurs if the FIND function cannot locate the target character (like a space). Nesting it inside an IFERROR function prevents this by supplying a fallback value.

Is there a way to extract text before a specific character other than a space?

Yes, you can modify the FIND portion of the formula. For example, to stop at a comma instead of a space, change FIND(" ",A1) to FIND(",",A1).