Data Import & Export

Combine Multiple Conditions into One Excel Row per Person

Muhammad TalhaMuhammad Talha Dec 2, 2026 868 views

Question details

Combine repeated person records so each person has one row with their conditions in separate columns.

Combine Multiple Conditions into One Excel Row per Person
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains multiple records for each person, with a condition on each record.
Observed behavior
The desired result is one row per person and date of birth, with associated conditions displayed across columns.
Before you start

Check that the source data has headers for Person, Date of Birth, and Condition, and that dates are stored consistently. Select the data and choose Insert > Table so Power Query can use it as a named source.

Solution 1Recommended

Group and pivot conditions with Excel Power Query

Use Power Query to create a refreshable table with one condition per numbered column.

1
Open the table in Power Query

Select a cell in the source table, then choose Data > From Table/Range.

2
Group the person records

In Power Query, choose Home > Group By. Use Advanced to group by Person and Date of Birth, and set the operation to All Rows with the new column name Rows.

3
Number each person's conditions

Choose Add Column > Custom Column. Name it Indexed Rows and enter Table.AddIndexColumn([Rows], "Condition Number", 1, 1, Int64.Type). Remove the original Rows column.

4
Expand and pivot the conditions

Use the expand button on Indexed Rows and select Condition and Condition Number. Change Condition Number to Text, select that column, and choose Transform > Pivot Column. Set Values Column to Condition and, under Advanced options, select Don't Aggregate.

5
Load the result

Choose Home > Close & Load. Rename the numbered columns if desired, and use Data > Refresh All after the source records change.

Group and pivot conditions with Excel Power Query
Repeated conditions: Each source record gets its own numbered column, including repeated conditions. Remove duplicates from the source or query first if each condition should appear only once per person.
Organize records in WPS Spreadsheets

Combine conditions across rows in WPS Spreadsheets

Use a helper column and lookup formulas in WPS Spreadsheets to place each person's conditions in separate columns.

  1. 1. Set up the source data: Open the workbook in WPS Spreadsheets. Put Person, Date of Birth, and Condition in columns A, B, and C, with data starting in row 2.
  2. 2. Create a lookup key: In D2, enter =LEN(A2)&":"&A2&"|"&IF(ISNUMBER(B2),TEXT(B2,"yyyy-mm-dd"),B2)&"|"&COUNTIFS($A$2:A2,A2,$B$2:B2,B2). Fill the formula down alongside the source records.
  3. 3. List each person once: Copy columns A and B to columns G and H, then select the copied data and choose Data > Remove Duplicates. Select both columns so each person and date-of-birth combination appears once.
  4. 4. Look up conditions across the row: In I2, enter =IFERROR(INDEX($C$2:$C$1000,MATCH(LEN($G2)&":"&$G2&"|"&IF(ISNUMBER($H2),TEXT($H2,"yyyy-mm-dd"),$H2)&"|"&COLUMN(A1),$D$2:$D$1000,0)),""). Fill the formula right for the required number of condition columns, then down for all people. Extend the row 1000 ranges if the source data is longer.
Arrange multiple conditions across one row per personOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and controls
microsoft office alternative - wps office

Frequently Asked Questions

How do I update the Power Query result when records change?

Add or edit records in the source table, then choose Data > Refresh All to update the loaded query.

How can I prevent two people with the same name from being combined?

Include Date of Birth in the Power Query Group By fields or in the formula criteria. If that combination is not unique, use a reliable person ID instead.

Why does the Excel formula show a spill error?

Clear any cells to the right of the formula that block its results. TRANSPOSE returns the matching conditions across multiple columns.

Can I keep repeated conditions in the output?

Yes. The Power Query numbering method keeps each source record. In the Excel formula method, remove UNIQUE from the formula to retain repeated values.