How to merge rows with Excel?

One way is to consolidate the rows using the SUM function, where the combined rows are placed elsewhere on the worksheet.

The procedure below gives the following result:

enter image description here

This is how I created the above:

  • Click on the target column (A9)
  • Position the Ribbon to the Data pane
  • Click Consolidate in the Data Tools group
  • In the dialog, select Sum from the drop-down list of Function:
  • Select the Input range (Sheet1!$A$2:$C$7)
  • Click the Add button to add it in the All references box
  • Select the Left column checkbox
  • Click OK

enter image description here

Similar option with LibreCalc:

enter image description here


Pivot Table

A. Go to location where you want to see your data gathered. Go to the Insert tab and click PivotTable

enter image description here

B. In the popup window, select your source data as the table/range to analyze, and hit OK

enter image description here

C. In the Pivot field lists, click and drag ID to the 'ROWS' pane; click and drag your VALUEn fields to the 'VALUES' pane.

D. Click the dropdown arrow next to 'Count of [VALUEn]' and select 'Value Field Settings'. Change 'Count' to 'Max' and hit 'OK'. Do this for all your VALUEn fields.

E. Right click any cell inside the Pivot table and select PivotTable Options. Go to the Totals & Filters tab. Uncheck the 'Show grand totals..' settings.

Here is your finished table:

enter image description here


Other than Data consolidation & Pivot Table, you can simply use Excel worksheet formula to summarize the data set.

enter image description here

How it works:

  • Enter this array (CSE) formula in cell G35, finish with Ctrl+Shift+Enter, and fill down.

    {=IFERROR(INDEX($G$26:$G$31, MATCH(0,COUNTIF($G$34:G34, $G$26:$G$31), 0)),"")}
    
  • Formula in cell H35:

    =IF(SUMPRODUCT(($G$26:$G$31=$G35)*(H$26:H$31))=0,"",SUMPRODUCT(($G$26:$G$31=$G35)*(H$26:H$31)))
    

N.B.

  • Fill the formula across.

  • As an alternative you may use SUMIF also.

  • Adjust cell references in the formula as needed.