Help with sorting my data by sum of SKU and then alphabetically

Copper Contributor

Hi all,

 

I am trying to sort a web store for my company. I have 504 orders with various products/quantities of products ordered. What I'd like to do is sort the orders by sum of SKU, and subsequently sort those orders by product alphabetically. So, e.g. all the orders with one item would show up first, and then orders with two, and so on, with the additional criteria that the 1-SKU orders (and then 2-SKU, etc.) are listed with products alphabetically. 

 

Hopefully this makes sense and I appreciate all feedback, thanks. 

 

 

2 Replies

@Ehrnstrom This makes sense if each order has one row per SKU; such a row would be referred to as a line item.  But calculating the sum of SKUs does not make sense; I believe you want to count (rather than sum) the SKUs ... or equivalently, count the line items for each order.

 

So if your worksheet includes data like this...  (Your data might be ordered by OrderID, but as you will see, this is not required for the calculation.)

Ehrnstrom_1.png 

...you should add a column that counts the number of rows per order.  The formula in this column could be (e.g., in row 2):

=COUNTIF( $A$2:$A$9999, $A2 )

 Copy that formula down through all your data rows.

 

Then the required sort columns for all the data are:

  1. the column containing that formula;
  2. the column containing the Order ID (this keeps the line items for an order next to each other); and
  3. the column containing the Description.

 

@SnowMan55 thank you! This was the breakthrough I needed!