+ Reply to Thread
Results 1 to 6 of 6

Pivot table - how to group combinations of value

  1. #1
    Registered User
    Join Date
    04-16-2021
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    91

    Pivot table - how to group combinations of value

    Hi,

    I have created a dummy-data sheet. The sheet tracks customer orders for paint colours. In the pivot, I have displayed this and it shows some customers bought multiple products. I want to be able to use the pivot to create a new category for each combination of paint ordered by a customer, e.g. if a customer buys green and red, create the category 'green and red' and count 1.

    Any ideas would be great but the real spreadsheet is much larger and more complex.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,542

    Re: Pivot table - how to group combinations of value

    This proposal adds a column (C) to the source data which is populated using the following array entered formula**:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    04-16-2021
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    91

    Re: Pivot table - how to group combinations of value

    Thanks for your help. I am going to pick your brain again if that's okay, I hope you like a challenge.

    In this example, one of the customers - customer 2345 - has bought the same product twice, but I only want it to show once in the final order column. Currently, it is showing it twice as 'Green, Red, Red', but I want it to show as 'Green, Red'.

    Secondly, some of the customers have the same products but they purchased them at different times. Customers 3456 and 4567 have both bought red and white paint, however, because customer 3456 bought white first the final order column is showing as 'White, Red'. Customer 4567 bought red first and it is showing as 'Red, White'.

    Can you think of a way around this so it is only showing each colour once in the final order column? Secondly, so the combinations in the final order column are always the same, even if customers purchased the products at different times to one another.

    I've put this in the New Version tab of this spreadsheet, hopefully it makes sense.

    Thanks again.
    Last edited by Excel_apprentice; 01-07-2022 at 12:50 PM.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,542

    Re: Pivot table - how to group combinations of value

    Not elegant, however it seems to work as modeled on the Old version sheet:
    1. Sort the paint colors ordered column A to Z
    2. Add a column (C) populated using: =IF(COUNTIFS(A$2:A2,A2,B$2:B2,B2)=1,B2,"")
    3. Modify the array entered formula** in the Final order columns to read: =IF(COUNTIFS(A$2:A2,A2)=1,TEXTJOIN(", ",1,IF(A$2:A$12=A2,C$2:C$12,"")),"")
    **See post #2
    Let us know if you have any questions.

  5. #5
    Registered User
    Join Date
    04-16-2021
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    91

    Re: Pivot table - how to group combinations of value

    That's genius, thank you.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,542

    Re: Pivot table - how to group combinations of value

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA group pivot table problem with hidden group
    By Palucci in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2021, 05:07 AM
  2. Group in Pivot Table
    By excelingtoexcel in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-15-2020, 03:57 PM
  3. [SOLVED] Pivot Table Count Combinations Binary Numbers
    By raychow22 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-17-2020, 06:08 PM
  4. Replies: 11
    Last Post: 06-24-2016, 08:43 AM
  5. Pivot table to split product combinations by age and gender
    By Glayva in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-01-2014, 01:13 PM
  6. [SOLVED] Getting a list of all possible combinations from different fields in a Pivot Table
    By wetbean in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-19-2013, 04:40 PM
  7. Replies: 5
    Last Post: 12-18-2012, 11:37 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1