Look Values in column 1 and bring column 2 values

后端 未结 3 1017
[愿得一人]
[愿得一人] 2020-12-11 14:39

my data set looks like

Col A   
A/05702; A/05724; A/05724;A/05724;A/05725;A/05725;
corresponding Col B
1;1;2;3;1;3;

I am trying to get the

3条回答
  •  一个人的身影
    2020-12-11 15:09

    You don't NEED vba, you can do this with a pivot table:

    Row Values:    Col A  
    Column Values: Col B  
    Values: Min of Col B
    

    You might need a UDF to concatenate the values easily, but that would be pretty simple too:

    Function JoinWithComma(cells As Range)
    
        Dim cell As Range, result As String
    
        For Each cell In cells
            If cell.Value <> "" Then
                result = result & cell.Value & ", "
            End If
        Next cell
    
        If Len(result) > 2 Then
            JoinWithComma = Left(result, Len(result) - 2)
        Else
            JoinWithComma = ""
        End If
    
    End Function
    

提交回复
热议问题