谢谢分享
Function HeBin(rng As Range, cell As Range, Optional col _
As Integer = 2, Optional str As String = ",") As String
Dim i As Long, arr, str2 As String, j As Integer
arr = rng.Value: str2 = cell.Value
For i = 1 To UBound(arr, 1)
If Len(arr(i, 1)) > 0 Then
j = j + 1
If arr(i, 1) = str2 Then HeBin = HeBin & arr(i, col) & str
End If
Next
If j > 0 Then HeBin = Left(HeBin, Len(HeBin) - 1)
End Function