whetstone

Combine SKUs

3 › ███░░░░░░░ · aggregation, arrays · requires: arrays · oner lambdaless golfed

Your client receives monthly sales reports, and needs them combined into a single yearly report. Each monthly table lists SKU, Quantity, Total Price, and Average Price — with SKUs repeating within and across months.

Collate the tables: for every SKU that appears anywhere, produce one row with the SKU, total Quantity, total Total Price, and the true Average Price (total price divided by total quantity). Row order is up to you.

Work on it

  1. Make a copy of the template — it becomes your private sheet.
  2. Solve it however you like — helper columns and extra tabs are fair game. The one rule: the grader swaps INPUT for other datasets, so never put your own content inside INPUT.
  3. Check yourself against the expected sample output shown in your copy (and below).
  4. Submit below — Share → "anyone with the link, Viewer", paste the link. Your sheet is graded against 3 hidden datasets, so hardcoded answers won't survive.

Sample

Input (Input!A1:L9)

SKUQuantityTotal PriceAverage PriceSKUQuantityTotal PriceAverage PriceSKUQuantityTotal PriceAverage Price
Item 122010Item 23186Item 56549
Item 2155Item 32147Item 622211
Item 34246Item 611212Item 222010
Item 13248Item 14369Item 711515
Item 45357Item 42168
Item 52189

Expected output (Answer!A2:D40)

SKUQuantityTotal PriceAverage Price
Item 19808.88888888888889
Item 26437.166666666666667
Item 36386.333333333333333
Item 47517.285714285714286
Item 58729
Item 633411.333333333333334
Item 711515

Adapted from "Combine SKUs" in the astral.cafe Community Practice Problems sheet.