0

Consider the following table in Excel:

status   | order | attribute 
---------------------------
purchased| table | brown
purchased| table | yellow
purchased| table |
purchased| sofa  |
purchased| sofa  | green
purchased| sofa  | 
purchased| pillow| brown
purchased| pillow| yellow
purchased| pillow|
shipped  | lamp  |
shipped  | lamp  |
shipped  | lamp  |
shipped  | desk  | brown
shipped  | desk  | 
shipped  | desk  | 

I am trying to count each order by the attributes, so I can get a summary of the following data:

  1. Number of unique orders with no attributes
  2. Number of unique orders where one order has the brown attribute but no other attributes
  3. Number of unique orders where one order has the brown attribute and another has the yellow attribute

and so on. Ideally these numbers could also be split by status as well.

But based on the above table, the summary should look like this:

  1. Number of unique orders with no attributes: 1 (lamp)
  2. Number of unique orders where one order has the brown attribute but no other attributes: 1 (desk)
  3. Number of unique orders where one order has the brown attribute and another has the yellow attribute: 2 (table and pillow)

I've been Googling and testing for hours but to no avail.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
4lackof
  • 1,250
  • 14
  • 33
  • 1
    You should investigate count() and countifs(). – Solar Mike May 28 '18 at 08:06
  • @SolarMike Count() and Countifs() won't do unique. This can be done with pivot tables and pivot of pivots, or with modern Excel data model and the Distinct aggregation. – teylyn May 28 '18 at 08:34
  • It is possible to do it with Frequencies, but I wouldn't really recommend it unless the other methods aren't available to you. – Tom Sharpe May 28 '18 at 13:57

1 Answers1

0

Add the data to the Excel data model and then build pivot tables with the "distinct count" aggregation. Play with the order of things to arrive at your desired results. You may need to build more than one pivot table to show all your desired outcomes.

enter image description here

teylyn
  • 34,374
  • 4
  • 53
  • 73