How to Group Records by the First Word in a Packaging Field
Question details
The user needs to group records based on the first word of a text field, such as extracting sizes (LARGE, MEDIUM, SMALL) from combined packaging descriptions.

- Product
- Spreadsheets / Database
- Device & OS
- not provided
- Scenario
- Organizing, sorting, or summarizing inventory and packaging data where multiple attributes are combined into a single text entry.
- Observed behavior
- The size information is merged with product names in a single text string (e.g., 'LARGE TUNDRA BOX'), making it impossible to directly group or categorize the records by size.
Before attempting to extract the first word, quickly scan your data column to confirm that the target word (e.g., the size) is consistently separated from the rest of the text by a space.
Extract the First Word Using Text Formulas
Use text extraction formulas to isolate the first word into a helper column, which can then be used to group or summarize the records.
If your data layout is fixed and you cannot permanently change the database schema, using standard spreadsheet formulas like LEFT and FIND (or SPLIT in some programming contexts) is the most efficient workaround.
Insert a new column next to your 'Packaging' field and name it 'Size' (or the relevant category name).
In the first cell of your new column (e.g., B2), enter the formula: =LEFT(A2, FIND(" ", A2)-1). This finds the first space and extracts all text to the left of it.
To prevent errors on fields that only contain one word, wrap the formula in an error handler: =IFERROR(LEFT(A2, FIND(" ", A2)-1), A2).
Highlight your dataset, insert a PivotTable, and drag the newly created 'Size' column into the Rows area to group your records by the first word.
Separate Attributes into Distinct Fields (Database Best Practice)
Redesign your table to store the size independently from the product name, improving data validation and making grouping highly reliable.
Easily Split and Group Records with WPS Spreadsheet
WPS Spreadsheet provides intuitive text-to-column wizards, advanced data extraction formulas, and powerful PivotTables to help you quickly organize complex datasets without writing code.
- 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your packaging records.
- 2. Use Text to Columns: Highlight the packaging column, go to the 'Data' tab, and click 'Text to Columns'. Choose 'Delimited' and check the 'Space' option to separate the first word.
- 3. Group with PivotTables: Select your newly organized data, go to the 'Insert' tab, click 'PivotTable', and drag the extracted first-word column to the Rows section to group your records.

Frequently Asked Questions
What if the first word is separated by a comma or dash instead of a space?
You can adjust the delimiter in your formula. For example, if words are separated by a dash, change the formula to =LEFT(A2, FIND("-", A2)-1). If using the Text to Columns feature, simply check 'Other' and type your specific delimiter symbol.
How can I extract the last word instead of the first?
Extracting the last word requires a slightly more complex formula. You can use =TRIM(RIGHT(SUBSTITUTE(A2, " ", REPT(" ", LEN(A2))), LEN(A2))), which replaces spaces with large blocks of spaces, grabs the rightmost block, and trims it down to the final word.
Will extracting data using formulas slow down my spreadsheet?
Using LEFT and FIND formulas on a few thousand rows will not cause noticeable lag. However, if you are working with hundreds of thousands of records, using the 'Text to Columns' feature to permanently split the text is much faster and reduces file size.




