答案 0 :(得分:0)
一种方法是使用用户定义的函数来制作以逗号分隔的列表
Function MergeCOO(rId As Range, r1 As Range, r2 As Range) As String
Dim vIdx As Variant
Dim vCOO As Variant
Dim Id As Variant
Dim i As Long, str As String
Dim c As New Collection
Id = rId.Value
vIdx = r1
vCOO = r2
On Error Resume Next
For i = LBound(vIdx, 1) To UBound(vIdx, 1)
If vIdx(i, 1) = Id Then
c.Add vCOO(i, 1), vCOO(i, 1)
If Err.Number <> 0 Then Err.Clear
End If
Next
For i = 0 To c.Count
str = str & c.Item(i) & ","
Next
MergeCOO = Left(str, Len(str) - 1)
End Function
将工作表添加到工作表
中的列L
=MergeCOO([@[HS Code]],[HS Code],[COO])
然后,您可以根据需要将此额外列添加到报告中