有三列数字:如A1=1,B1=3,C1=1,A2=5,B2=5,C2=6,A3=8,B3=7,C3=0........,。想将三列合并到一列:D1

2025-02-24 11:33:00
推荐回答(4个)
回答1:

IF(AND(A5=B5,B5=C5),"a",IF(AND(A5=B5,A5<>C5),"a"&C5,IF(AND(A5=C5,C5<>B5),"a"&B5,IF(AND(C5=B5,B5<>A5),A5&"a",A5&B5&C5))))
以上公式设定重复数字用字母a代替,如果0-9用不同的字母代替,建议设辅助列,先设好0-9对应的字母,然后用VLOOKUP替换以上公式的字母a即可

回答2:

Sub 合并()
For idx = 1 To 100 '把100换成需要更改的行数。
Cells(idx, 4).NumberFormatLocal = "@"
Cells(idx, 4).HorizontalAlignment = xlCenter
If (Cells(idx, 1) = Cells(idx, 2)) Then
Cells(idx, 4) = CStr(Cells(idx, 1)) + CStr(Cells(idx, 2)) + CStr(Cells(idx, 3))
ElseIf (Cells(idx, 1) = Cells(idx, 3)) Then
Cells(idx, 4) = CStr(Cells(idx, 1)) + CStr(Cells(idx, 3)) + CStr(Cells(idx, 2))
ElseIf (Cells(idx, 3) = Cells(idx, 2)) Then
Cells(idx, 4) = CStr(Cells(idx, 2)) + CStr(Cells(idx, 3)) + CStr(Cells(idx, 1))
Else
Cells(idx, 4) = CStr(Cells(idx, 1)) + CStr(Cells(idx, 2)) + CStr(Cells(idx, 3))
End If
x = CStr(Mid(Cells(idx, 4), 1, 2))
y = CStr(Mid(Cells(idx, 4), 3, 1))
If x = 11 Then
Cells(idx, 4) = "a" + y
ElseIf x = 22 Then Cells(idx, 4) = "b" + y
ElseIf x = 33 Then Cells(idx, 4) = "c" + y
ElseIf x = 44 Then Cells(idx, 4) = "d" + y
ElseIf x = 55 Then Cells(idx, 4) = "e" + y
ElseIf x = 66 Then Cells(idx, 4) = "f" + y
ElseIf x = 77 Then Cells(idx, 4) = "g" + y
ElseIf x = 88 Then Cells(idx, 4) = "h" + y
ElseIf x = 99 Then Cells(idx, 4) = "i" + y
ElseIf x = "00" Then Cells(idx, 4) = "j" + y
End If
Next idx
End Sub

回答3:

邮件里有我QQ,你加下,现在这个电脑有问题,登陆后打开知道非常慢

回答4:

没看懂啊! 能解释下么 我可以找同学帮忙的!