How to quickly merge adjacent rows with same data in Excel?


Excel, a powerful spreadsheet tool by Microsoft, offers numerous functionalities that can enhance our data processing tasks. One such feature is the ability to merge adjacent rows containing similar data, eliminating duplicates and reducing clutter in the spreadsheet. In this article, we will explore an efficient method to quickly merge adjacent rows with identical information in Excel. Consolidating similar values using merged cells assists in preventing potential miscalculations due to inadvertent repetitions while simplifying spreadsheet maintenance.

Benefits of Merging Adjacent Rows With the Same Data

Optimized Space Utilization

By merging adjacent rows containing duplicate information into a single row, we can significantly optimize space utilization within your Excel sheet. This negates the need for surplus duplicates or empty cells, allowing for more efficient organization and readability of data.

Enhanced Readability

When working with sizeable datasets or spreadsheets containing numerous repetitive values across several rows, locating specific information can be time-consuming and laborious. By utilizing the "Merge & Center" function in Excel to combine repetitive cells into one consolidated cell, we create cleaner layouts that improve readability by reducing clutter.

Effortless Sorting and Filtering

Merged cells help facilitate effective sorting and filtering operations in Excel since they streamline similar content onto a single line rather than scattered across multiple ones. For instance, if we are cataloging product sales on an e-commerce website where multiple customers have made identical purchases daily over several weeks – merging those adjacent rows eliminates duplication during filtering processes based on customer names or purchased items.

Accelerated Calculation Processes

Another notable benefit offered by merged cells is improved calculation speed within formulas involving lookup functions such as SUMIFS(), COUNTIFS() and AVERAGEIFS() which often require range selections requiring precise inputs without replication errors (like avoiding overlapping ranges).

Quickly Merging Adjacent Rows With Same Data Using “Merge & Centre” Option

Step 1

Before merging the desired rows, it is essential to ensure that the dataset follows a consistent structure. Arrange the data so that columns containing matching values are next to each other. This arrangement will make the merging process simpler and more effective. Scan through the worksheet and identify which columns or fields we wish to compare for duplicate values. These could be names, identification numbers, dates, or any other relevant information depending on the dataset. Open the desired spreadsheet with data.

Step 2

Select the data with similar ones and from the “Home” tab, choose “Merge and Centre” option.

Step 3

After selecting the “Merge & Centre” option, a popup window opens and click “Ok”.

Step 4

After merging all the adjacent items with same data, the final window looks like the below one,

Quickly Merging Adjacent Rows With the Same Data Using “VBA Macro” Option

Step 1

Open the desired worksheet. The below sheet has the same data in adjacent cells.

Step 2

Open the Visual Basic for Application window by clicking the “Ctrl+F11” shortcut. Then select the “Insert” tab and from the drop-down choose “Module” option.

Step 3

In the module window insert the below code, to merge the adjacent cells with the same data.

Option Explicit
Sub Mergesamedata()
Application.DisplayAlerts = False
Dim rg As Range
MergeCells:
For Each rg In Selection
If rg.Value = rg.Offset(1, 0).Value And rg.Value <> "" Then
Range(rg, rg.Offset(1, 0)).Merge
GoTo MergeCells
End If
Next
End Sub

Step 4

First, select all the data which needs to be merged. In the Excel sheet, press “Alt+F8” shortcut to open the macro window.

Step 5

After clicking the “Run” option, the similar data will be merged.

Conclusion

Efficiently managing large volumes of data often requires eliminating duplicate entries or combining similar information. By following these step-by-step instructions, we have learned how to quickly merge adjacent rows containing identical data using Excel’s powerful features. This process not only enhances readability but also saves time by reducing manual efforts associated with duplication tasks. So, streamline the workflow today and unleash the full potential of Excel for effective data management.

Updated on: 19-Oct-2023

91 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements