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
在C1中输入或复制粘贴下列公式
=IF(ISNUMBER(FIND(B1,A1)),B1,"")
或
=IF(COUNTIF(A1,"*"&B1&"*"),B1,"")
下拉填充
C1=SUBSTITUTE(A1,SUBSTITUTE(A1,B1,""),"")