-1
我有一個數據源,我需要在一個彙總表中顯示它們。數據透視表字符串逗號分隔
請參閱從atached文件輸出表,讓我知道我怎麼能作出這樣的
Please find the sample attachment
我有一個數據源,我需要在一個彙總表中顯示它們。數據透視表字符串逗號分隔
請參閱從atached文件輸出表,讓我知道我怎麼能作出這樣的
Please find the sample attachment
一種方法是有一個用戶定義的函數,使逗號分隔的列表
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])
然後,您可以將這個額外的列添加到您的報告中,只要您認爲合適