Cell with "multiple" values separated in slicers as unique values? (EXCEL 2013)

rabert

New Member
Joined
May 8, 2013
Messages
5
Let's say I have three columns where column C can contain "multiple" values like "John, Pete" instead of just "John" or "Pete". See table below...

Is it possible in some way to make the slicer for Column C just show the unique values "John", "Pete", "George", instead of the combined ones like "George, John"?
I would not like to use several rows to define unique values in the slicer for column C. Otherwise I don't care how it can be fixed. New columns with formulas, advanced slicer options or VBA etc? Doesn't matter as long as only one slicer displays unique values....


Column AColumn BColumn C
Red2John, Pete
Green3Pete
Blue4George, John

<tbody>
</tbody>
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
data is like this
Excel Workbook
ABC
1hdng1hdng2hdng3
2Red2John, Pete
3Green3Pete
4Blue4George, John
Sheet1




run the macro "test" and see column D

Code:
Sub test()
    Dim j As Integer, r As Range, c As Range, k As Integer, m As Integer, n As Integer
    Dim x() As String, y As String, p As Integer
    Range("d1").EntireColumn.Delete
    Set r = Range(Range("C2"), Range("C2").End(xlDown))
    For Each c In r
        j = Len(c)
        k = Len(WorksheetFunction.Substitute(c, ",", ""))
        'msgbox j: 'msgbox k
        p = j - k
        'msgbox p
        'this is number of commas in c
        m = 1
        ReDim x(1 To p + 1)
        y = ""
        For k = 1 To p + 1
            On Error GoTo nextstep
            n = WorksheetFunction.Search(",", c)


            'msgbox n
nextstep:
            x(k) = Mid(c.Value, m, n - 1)
            'msgbox x(k)
            y = y & """" & x(k) & """" & ","
            'msgbox y
            m = n + 1
        Next k
        'msgbox y
        c.Offset(0, 1) = Left(y, Len(y) - 2)
        y = ""
    Next c
    Range("d1").EntireColumn.AutoFit
    MsgBox "macro over"
End Sub
 
Upvote 0
Thanks for the reply!

This is what I get:
300w87t.jpg


This would still result in multiple values in a slicer. What outcome did you have in mind?
 
Upvote 0
In column C there can be multiple names, they will never spread over several columns. I want to a be able to separate these names in a slicer or vba-listbox or something like that.

So instead of a slicer or listbox showing three values with multiple names;
14ecegk.jpg


...I want the slicer or listbox to show;

2bp4sx.jpg


So, for instance, when John is selected only row three should be filtered away since that row don't contain the name John.
 
Upvote 0
sorry still not clear. does this mean columns A and B are not relevant. you want only the unique values of column C in that case do ADVANCED FILTER to colmn s in the advanced filter window copytorange shoud be different cell, critiera range blank, unique should be true.
 
Upvote 0

Forum statistics

Threads
1,215,682
Messages
6,126,195
Members
449,298
Latest member
Jest

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top