Function str(x, y, z) xa = Split(x, ",") ya = Split(y, ",") If UBound(xa) <> UBound(ya) Then str = ",不匹配": Exit Function For i = 0 To UBound(xa) - 1 If ya(i) = z Then str = str & xa(i) & "," Next iEnd Function