Excel中找出两列数据中相同的字段,显示在第三列

2024-12-03 20:47:57
推荐回答(3个)
回答1:

excel vba,这个得用like函数

Sub chc()

Dim i As Integer
For i = 1 To 1000

If Sheets(1).Cells(i, 1).Value Like "*" & Sheets(1).Cells(i, 2).Value & "*" Then

Sheets(1).Cells(i, 3).Value = Sheets(1).Cells(i, 2).Value
End If
Next i

End Sub

回答2:

在C1中输入或复制粘贴下列公式
=IF(ISNUMBER(FIND(B1,A1)),B1,"")

=IF(COUNTIF(A1,"*"&B1&"*"),B1,"")
下拉填充

回答3:

C1=SUBSTITUTE(A1,SUBSTITUTE(A1,B1,""),"")