# Merging cells
To merge a range of cells, use ->mergeCells[$range]
.
$sheet->mergeCells['A1:E1'];
# Merging columns and rows
To merge columns and rows, use ->setMergeColumn[$array]
.
$sheet->setMergeColumn[array[
'columns' => array['A','B','C','D'],
'rows' => array[
array[2,3],
array[5,11],
]
]];
For a Microsoft Excel 98 version and a Microsoft Excel 2001 for Mac version of this article, see 179045. You may be unable to use the AutoFit feature for columns or rows that contain merged cells in Microsoft Excel. In addition, if the Wrap Text feature is also selected, text is not wrapped automatically. In Excel, you cannot use the AutoFit feature on a column that contains a cell merged with cells in other columns. Likewise, you cannot use AutoFit on a row that contains a cell merged with cells in other rows. When you use merged cells, manually adjust row height and column width by using the following procedures, as appropriate for the version of Excel
that you are running. On the Format menu, point to Row, and then click Height. On the Format menu, point to Column, and then click Width. Symptoms
Cause
Workaround
Microsoft Office Excel 2003 and earlier versions of Excel
Microsoft Office Excel 2007
On the Home tab, click
Format in the Cells group, and then click
Row Height.On the Home tab, click
Format in the Cells group, and then click
Column Width.
Need more help?
Merge Cells is an add-in for Microsoft Excel that combines multiple text cells. Use it to join values from several cells to one and merge several cells, rows, or columns keeping all data.
- Before you start
- Merging options
- Start Merge Cells
- How to combine Excel cells, columns, and rows
- Combine cells with aggregate Excel functions
- Related links
Before you start
- A special Back up this worksheet option will create a safe copy of your original sheet.
- The add-in brings together all areas in the selection, including non-adjacent ones.
Merging options
After you select the range, you'll have to pick one of the merging options for the cells. Please see below the examples of how each of them works.
Start Merge Cells
Run the add-in by clicking on its icon in the Merge group on the Ablebits Data tab:
How to combine Excel cells, columns, and rows
The add-in's window lets you adjust the following options:
- Select the range in your worksheet or use the Expand selection or Select range icons on the right.
- In this dropdown, choose the merging option: Columns into one, Rows into one, Cells into one.
- Combine with offers a set of standard delimiters to use between the merged values: semicolon, comma, period, space, line break. Also, you can scroll down to select an aggregate function, please see more details in the
Combine cells with aggregate Excel functions section.
Tip. You can enter any combination of characters into the field or leave it blank to stitch the values together. The separators you enter manually are saved in the drop-down list for the next time you use the add-in.
- Choose destination for the result in the Place the results to drop-down list: left or right column; top or bottom row; top-left, top-right, bottom-left, or bottom-right cell.
- Use the additional options to adapt the results to your table:
- Check the Clear the contents of the selected cells checkbox to delete the source values after merging them.
- If you want to combine the selected cells, and not only their values, choose to Merge all areas in the selection.
- Avoid getting extra separators when merging values by checking off Skip empty cells.
- Select the Wrap text option to make the joined values visible in your worksheet.
- We recommend selecting Back up this worksheet to get a copy of your current table as is.
Click the Merge button to combine values from the selected columns in Excel.
Combine cells with aggregate Excel functions
If you've got numerical data, you can not only combine values but also apply aggregate Excel functions. For this, select the function of interest in the Combine with drop-down list:
Note. For the calculations, the tool uses the standard Excel functions [AVERAGE, COUNT, COUNTA, MAX, MIN, SUM], so if you face certain difficulties, please consult a corresponding section here.
- How to merge two tables in Excel
- How to merge duplicates in Excel
- How to consolidate several files in Excel
- How to combine worksheets by columns