• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

what brands a user has.?

Chetan

New Member
Dear Excel Gurus,

i came across a situation wherein i have to answer what Brands a user has.?
Please refer to attached file.

i have a user list with product brands owned by them. Now in the last columns (K in my data), want to get the Name of Brands a user has. (column K will update as soon a put Yes in Range C3:J15).

Any help in this will be appreciated.

Thanks,
Chetan
 

Attachments

  • User Product.xlsx
    9.7 KB · Views: 10
Dear Excel Gurus,

i came across a situation wherein i have to answer what Brands a user has.?
Please refer to attached file.

i have a user list with product brands owned by them. Now in the last columns (K in my data), want to get the Name of Brands a user has. (column K will update as soon a put Yes in Range C3:J15).

Any help in this will be appreciated.

Thanks,
Chetan
Hi,

Please refer to attachment...

I used helper rows to concatenate using a UDF (user defined function).
UDF can be found here:
http://chandoo.org/wp/2008/05/28/how-to-add-a-range-of-cells-in-excel-concat/

Hope this helps
 

Attachments

  • User Product.xlsm
    18.3 KB · Views: 7
Dear Hui and PCosta,

thank you very much for your respective replies. It was a learning for me.

After several research on Google i found below UDF. and it is working exactly as per my requirement.

Code:
Function ConcatenateIf(CriteriaRange As Range, Condition As Variant, _
        ConcatenateRange As Range, Optional Separator As String = ",") As Variant
    Dim i As Long
    Dim strResult As String
    On Error GoTo ErrHandler
    If CriteriaRange.Count <> ConcatenateRange.Count Then
        ConcatenateIf = CVErr(xlErrRef)
        Exit Function
    End If
    For i = 1 To CriteriaRange.Count
        If CriteriaRange.Cells(i).Value = Condition Then
            strResult = strResult & Separator & ConcatenateRange.Cells(i).Value
        End If
    Next i
    If strResult <> "" Then
        strResult = Mid(strResult, Len(Separator) + 1)
    End If
    ConcatenateIf = strResult
    Exit Function
ErrHandler:
    ConcatenateIf = CVErr(xlErrValue)
End Function

Thank you for your Help. i may bother you again.

Regards,
Chetan
 
Back
Top