Function Problems

How to Extract Text After a Specific Number of Spaces in Excel

Amos GikundaAmos Gikunda Nov 13, 2026 869 views

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.

How to Extract Text After a Specific Number of Spaces in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Select the output cell

Click the cell where you want the extracted text, such as B2.

2
Enter the dynamic extraction formula

In the formula bar, type =LET(firstChar,LEFT(SUBSTITUTE(A2," ",""),1),MID(A2,FIND(firstChar,A2),LEN(A2))) and press Enter.

3
Apply the formula to other rows

Drag the fill handle from B2 down to fill the formula for the remaining source cells.

Dynamically Extract Text After Leading Spaces with LET, SUBSTITUTE, LEFT, FIND, and MID
Formula returns clean values: The first non-space character is used as the starting point, so the formula works even when the indentation depth changes between rows.
WPS Spreadsheets formula

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. 1. Open your workbook: Launch WPS Office Spreadsheets and open the .xlsx, .xls, or .csv file that contains the indentation-based text.
  2. 2. Select the output cell: Click the empty cell where you want the cleaned or extracted value to appear, such as B2.
  3. 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. 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. 5. Save or export the result: Save the file in its current format or export it to .xlsx or .csv as needed.
Extract text after leading or fixed spaces without breaking values at every internal spaceUses Excel-compatible formulas including LET, SUBSTITUTE, LEFT, FIND, MID, and TRIMOpens and saves .xlsx, .xls, and .csv files with full Microsoft Office format compatibilityFree, lightweight spreadsheet editing with a familiar Excel-like interfaceProcess indentation-based columns directly without a Microsoft 365 subscription
microsoft office alternative - wps office

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.