Power Query: Combine Rows into a Single Cell in Excel

Jun 13, 2020 • 3 min read

A list with one row for every item is useful for storing data, but it is not always the easiest format to read. Sometimes we need one row per person, with all their related information collected in a single cell.

Power Query makes this possible with a few simple transformations and a small change to the M code. The trick is to use Group By to bring the related rows together, then use Text.Combine to turn their values into a readable list.

Our example contains employees and the equipment allocated to them. Anna Watkins, for example, has a laptop, an access card, a phone, and a home printer. We want all her equipment information, including its attributes, in one cell beside her name.

You can get the practice workbook from the example file page to work through the same steps.

1. Load the source data into Power Query

The source data is an Excel table with four columns:

  • First Name
  • Last Name
  • Equipment
  • Equipment Attributes

Each piece of equipment occupies a separate row, so an employee’s name appears several times.

  1. Select any cell within the source table.
  2. Click Data > From Table/Range.
  3. The Power Query Editor opens and displays the table’s data.

We will make two transformations: first, combine the equipment and its attributes across columns; then combine the equipment entries down the rows for each employee.

2. Merge the equipment and attribute columns

Before collecting each employee’s equipment into a list, we need to keep each item together with its associated details.

  1. Select the Equipment column heading, then hold Ctrl and select Equipment Attributes. Select them in that order so the equipment name comes first.
  2. Click Transform > Merge Columns.
  3. In the Separator dropdown, select Custom.
  4. Enter a colon followed by a space: : .
  5. Set the new column name to Equipment.
  6. Click OK.
Merge Columns dialog with a custom separator and Equipment as the new column name

The two original columns are now a single Equipment column. Each row contains an equipment name followed by a colon, a space, and its attribute.

This separator serves one purpose: keeping the details within each equipment entry readable. Later, we will use a different separator between the equipment entries themselves.

3. Group the rows by employee

Next, we need to tell Power Query which rows belong together. In this example, we use the First Name and Last Name columns.

Select the columns that identify the groups, not the column whose values you want to combine.

  1. Select First Name and Last Name.
  2. Click Transform > Group By.
  3. Confirm that Advanced is selected and that both name columns appear as grouping fields.
  4. Enter Equipment as the new column name.
  5. Select Sum as the operation.
  6. Select Equipment as the column to aggregate.
  7. Click OK.

If you need additional grouping columns, the dialog’s Add grouping button lets you include them.

Group By dialog configured with First Name and Last Name grouping fields and a Sum operation on Equipment

At this point, the Equipment column contains errors. That is expected.

We deliberately selected Sum even though our equipment entries are text. Sum cannot add those text values, but it gives us the grouping structure we need. Rather than write the entire transformation ourselves, we can now change the generated function.

4. Replace List.Sum with Text.Combine

If the formula bar is not visible, select View > Formula Bar.

In the formula for the grouping step, find this expression:

List.Sum([Equipment])

Replace it with:

Text.Combine([Equipment], "; ")

There are two important parts to this expression:

  • [Equipment] supplies the equipment values from the rows in each employee’s group.
  • "; " places a semicolon and a space between those values.

Be sure to put the separator inside double quotation marks. The comma before it separates the function’s arguments; it is not part of the resulting text.

A complete grouping step can look like this, assuming the preceding step is named Merged Columns:

Table.Group(
    #"Merged Columns",
    {"First Name", "Last Name"},
    {
        {
            "Equipment",
            each Text.Combine([Equipment], "; "),
            type text
        }
    }
)

Keep your existing preceding-step reference if it differs. If the generated aggregation still declares type number, change that to type text to match the combined result.

Confirm the formula edit. Fantastic, the errors are replaced by a single equipment list for each employee.

The distinction between the two separators is worth remembering:

  • Colon and space: separates an equipment name from its attribute.
  • Semicolon and space: separates one equipment entry from the next.

For more detail on the function’s arguments, see Microsoft’s Text.Combine documentation.

5. Load the combined results into Excel

With one row per employee and their equipment combined into a single cell, the data is ready to return to the worksheet.

  1. Click Home > Close & Load > Close & Load To....
  2. In the Import Data dialog, select Table.
  3. Select Existing worksheet.
  4. Choose cell F1 as the destination for this example.
  5. Click OK.
Excel worksheet showing the original employee equipment data on the left and grouped equipment lists on the right
Each employee now has one row, with their equipment details collected in a single cell.

The result retains the First Name and Last Name columns, with one Equipment cell containing all the related entries.

That is the key to combining rows into a single cell with Power Query: build the grouping through the interface, then replace the numeric aggregation with Text.Combine. A small formula change turns a detailed list into a much more readable output.

Share

Excel Off The Grid

I help you reduce repetitive Excel work with practical guides to formulas, Power Query, reporting, and automation.

© 2026 Excel Off The Grid
Powered by Convella