可以用vba实现。代码如下。
Sub 合并()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
m = [E65536].End(xlUp).Row
x = Cells(2, 5): j = 1: z = 0
For i = 3 To m
y = Cells(i, 5)
If x <> y Then
x = y
If j > 1 Then Range(Cells(z, 5), Cells(z + j - 1, 5)).MergeCells = True: j = 1
Else
j = j + 1
If j = 2 Then z = i - 1
End If
Next i
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "相同数据合并完成!"
End Sub
追问我不会的,其他的方法有吗?
追答单纯用函数不可以实现的。你不会vba,可以把样表发给我我给你设置好vba,以后你只需把数据粘贴进去,点击按钮瞬间就可以完成你说的要求。