Forum Discussion
Ehrnstrom
Nov 17, 2022Copper Contributor
Help with sorting my data by sum of SKU and then alphabetically
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 subsequen...
SnowMan55
Nov 18, 2022Bronze Contributor
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.)
...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:
- the column containing that formula;
- the column containing the Order ID (this keeps the line items for an order next to each other); and
- the column containing the Description.