Function Problems

Use a Dynamic Ending Row in an Excel TEXTJOIN Formula for Grouped Values

Elise WilliamsElise Williams Nov 12, 2026 869 views

Question details

Combine all values belonging to the same group with TEXTJOIN while avoiding a manually fixed ending row.

Use a Dynamic Ending Row in an Excel TEXTJOIN Formula for Grouped Values
Product
Microsoft Excel
Device & OS
not provided
Scenario
The group identifier is in column C and the values to combine are in column D. The user wants the combined result to appear only on the first row of each group.
Observed behavior
A dynamic array formula can filter matching records for the current group and join them with a chosen delimiter.
Before you start

Make sure the group IDs in column C and the values in column D begin on row 2 and use matching data ranges. This formula requires a spreadsheet version that supports the FILTER and TEXTJOIN functions.

Solution 1Recommended

Use TEXTJOIN and FILTER to combine every value in a group

Use this formula when group IDs are in column C and the values you want to combine are in column D.

The IF check suppresses repeated results. FILTER returns all column D values whose group ID matches the current row, and TEXTJOIN combines those values with a semicolon and space.

1
Select the first result cell

Click cell E2, or the first cell in your output column next to the source data.

2
Enter the dynamic grouping formula

Type or paste =IF(C2=C1,"",TEXTJOIN("; ",TRUE,FILTER($D$2:$D$1000000,$C$2:$C$1000000=C2,""))) and press Enter.

3
Fill the formula down

Drag the fill handle from E2 down the output column, or double-click the fill handle if the adjacent data column is continuous.

4
Review the first row of each group

Check column E. Each group’s combined values appear on its first row, while later rows with the same ID remain blank.

Use TEXTJOIN and FILTER to combine every value in a group
Dynamic group results: The formula searches rows 2 through 1,000,000, so you do not need to update the ending row as new records are added within that range.
WPS Spreadsheet formula tools

Combine grouped spreadsheet values dynamically in WPS Spreadsheet

WPS Spreadsheet lets you build a TEXTJOIN and FILTER formula to collect matching values by group without manually changing the final row each time your data grows. Enter the formula in the first output cell and fill it down to return one combined result for each group.

  1. 1. Open the worksheet in WPS Spreadsheet: Open your .xlsx workbook in WPS Office and select the worksheet containing the group IDs and values.
  2. 2. Choose the output cell: Click E2, or select the first empty cell in the column where you want the joined result to appear.
  3. 3. Insert the formula: Enter =IF(C2=C1,"",TEXTJOIN("; ",TRUE,FILTER($D$2:$D$1000000,$C$2:$C$1000000=C2,""))) and press Enter.
  4. 4. Copy the result down the column: Drag the fill handle from the selected formula cell down the required rows to calculate each group result.
Use TEXTJOIN and FILTER to combine values for matching group IDs.Fill formulas down quickly with the drag handle or AutoFill.Work with Microsoft Excel .xlsx files while keeping formulas in a familiar spreadsheet layout.Use a lightweight, easy-to-use spreadsheet interface for data cleanup and reporting.
QA img-9

Frequently Asked Questions

Why does the TEXTJOIN result appear only on the first row of each group?

The leading IF(C2=C1,"",...) condition compares the current group ID with the prior row. When they match, it returns a blank; when they differ, it calculates the joined result.

Can I change the semicolon between joined values?

Yes. Replace "; " in TEXTJOIN with another delimiter, such as ", ", " | ", or CHAR(10) for line breaks. If you use CHAR(10), enable Wrap Text from Home > Wrap Text to display each value on a new line.

What happens if a group has blank values in column D?

The TRUE argument in TEXTJOIN tells the formula to ignore empty values. The group can still be evaluated, but blank value cells are not added to the joined text.

How can I avoid using the $D$2:$D$1000000 range?

Convert the source range to an Excel Table using Insert > Table, then use structured references such as Table1[Value] and Table1[Group]. Table columns expand automatically as records are added.

Why does FILTER return a function error in my spreadsheet?

FILTER is available only in spreadsheet versions that support dynamic array functions. Update your spreadsheet application, or use an alternative approach based on INDEX, MATCH, helper columns, or Power Query if FILTER is unavailable.