How to Extract Text After a Specific Number of Spaces in Excel
Question details
The user needs to separate text based on indentation or leading spaces so that columns return values such as Item or BandCombination without incorrectly splitting at every space.

- Product
- WPS Office Spreadsheets
- Device & OS
- not provided
- Scenario
- A worksheet contains text values where indentation or leading spaces indicate meaning, and the user wants to extract only the meaningful text or split columns without treating every space as a delimiter.
- Observed behavior
- The desired goal is to return clean column values such as Item or BandCombination by removing or skipping a specific number of leading spaces instead of applying a space condition to all spaces.
Open the worksheet in WPS Office Spreadsheets and confirm whether the values use consistent leading spaces or varying indentation. Make sure your version of WPS Office supports the LET, SUBSTITUTE, LEFT, FIND, and MID functions if you plan to use the dynamic extraction formula.
Dynamically Extract Text After Leading Spaces with LET, SUBSTITUTE, LEFT, FIND, and MID
Use this method when the number of leading spaces varies and you want to return all text starting from the first non-space character.
This formula removes all spaces temporarily to find the first visible character, then locates that character in the original text and extracts from its position. It avoids splitting the string at every internal space, so values such as Item or BandCombination remain intact.
Click the cell where you want the extracted text, such as B2.
In the formula bar, type =LET(firstChar,LEFT(SUBSTITUTE(A2," ",""),1),MID(A2,FIND(firstChar,A2),LEN(A2))) and press Enter.
Drag the fill handle from B2 down to fill the formula for the remaining source cells.

Remove Leading and Repeated Spaces with TRIM
Use this simple method when the goal is to clean leading, trailing, and repeated spaces rather than control indentation by a specific count.
Skip a Fixed Number of Leading Spaces with REPLACE or MID
Use this method when all source values start with the same number of leading spaces and you need to remove exactly that indentation count.
Extract Text After a Specific Number of Spaces in WPS Office Spreadsheets
WPS Office Spreadsheets supports Excel-compatible functions such as TRIM, MID, REPLACE, LET, SUBSTITUTE, LEFT, and FIND. You can clean indentation-based text or split it into the required Item or BandCombination values directly in a familiar spreadsheet grid.
- 1. Open your workbook: Launch WPS Office Spreadsheets and open the .xlsx, .xls, or .csv file that contains the indentation-based text.
- 2. Select the output cell: Click the empty cell where you want the cleaned or extracted value to appear, such as B2.
- 3. Enter the appropriate formula: Type =TRIM(A2), =MID(A2,4,LEN(A2)), or the LET-based formula in the formula bar, depending on whether you need to remove all spaces or skip a specific indentation count.
- 4. Press Enter and fill down: Press Enter to confirm the formula, then drag the fill handle down to apply it to the rest of the rows.
- 5. Save or export the result: Save the file in its current format or export it to .xlsx or .csv as needed.

Frequently Asked Questions
How do I remove only leading spaces in WPS Office Spreadsheets?
Use =TRIM(A2) in an empty cell and press Enter. TRIM removes leading, trailing, and repeated spaces, so it returns a clean text value but does not preserve a specific indentation level.
Can I extract text after a fixed number of leading spaces instead of all spaces?
Yes. If all cells have the same indentation, use =MID(A2,4,LEN(A2)) to skip 3 leading spaces or =REPLACE(A2,1,3,"") to remove the first 3 characters. Adjust the number to match your specific space count.
How do I extract text when the number of leading spaces varies between rows?
Use a dynamic formula such as =LET(firstChar,LEFT(SUBSTITUTE(A2," ",""),1),MID(A2,FIND(firstChar,A2),LEN(A2))). It locates the first non-space character and returns the text from that position.
Which WPS Office version supports LET and LAMBDA functions for this extraction?
Recent versions of WPS Office Spreadsheets support modern Excel-compatible functions. If LET or LAMBDA is not available in your version, update WPS Office or use the TRIM, MID, and REPLACE alternatives.
Will these formulas work with files created in Microsoft Excel?
Yes. WPS Office Spreadsheets is compatible with .xlsx, .xls, and .csv files, and the functions work the same way when you open Microsoft Excel workbooks in WPS Office.




