I would like to suggest you the VBA code to achieve your goal, since it's the best and easiest possible method to apply.
You can use the below written VBA code to Merge adjacent cells in Right Column, if the values Left to them are duplicate.
Check the Screen Shot:
![enter image description here](../../I/static/images/533611df1710c718ea136192923b6d9ac28b99e5dcbe1df8e89a3fb7db1b8797.png)
Sub MergeSameCell()
Dim Rng As Range, xCell As Range
Dim xRows As Integer
xTitleId = "Merge Cells In Excel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
xRows = WorkRng.Rows.Count
For Each Rng In WorkRng.Columns
For i = 1 To xRows - 1
For j = i + 1 To xRows
If Rng.Cells(i, 1).Value <> Rng.Cells(j, 1).Value Then
Exit For
End If
Next
WorkRng.Parent.Range(Rng.Cells(i, 2), Rng.Cells(j - 1, 2)).Merge
WorkRng.Parent.Range(Rng.Cells(i, 3), Rng.Cells(j - 1, 3)).Merge
WorkRng.Parent.Range(Rng.Cells(i, 4), Rng.Cells(j - 1, 4)).Merge
i = j - 1
Next
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
How to use the Code:
- Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic
for Applications window.
- Click Insert then Module, and paste the Code.
- Run the Macro.
- When Input box appear select the Data range where Duplicate values
are Available.
- Finish with ok.
You get the job done.
Glad to hear from you @Sans, & happy to help you,, keep asking :-) – Rajesh S – 2018-05-04T13:28:28.707