Others

How to Group Records by the First Word in a Packaging Field

Elise WilliamsElise Williams Nov 3, 2026 868 views

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.

How to Group Records by the First Word in a Packaging Field
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 you start

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.

Solution 1Recommended

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.

1
Create a helper column

Insert a new column next to your 'Packaging' field and name it 'Size' (or the relevant category name).

2
Apply the text extraction formula

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.

3
Handle single-word fields

To prevent errors on fields that only contain one word, wrap the formula in an error handler: =IFERROR(LEFT(A2, FIND(" ", A2)-1), A2).

4
Group your records

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.

Formula Tip: If you are writing a macro or script, using the Split(packaging_name, " ")(0) function achieves the exact same result programmatically.
Advanced Data Management

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. 1. Open your dataset: Launch WPS Spreadsheet and open the document containing your packaging records.
  2. 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. 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.
Effortlessly separate combined text fields using the built-in Text to Columns feature.Seamlessly compatible with Microsoft Excel formulas, PivotTables, and file formats.Quickly summarize and group your extracted records for cleaner data analysis.
microsoft office alternative - wps office

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.