In Google Docs (which shares many commands with excell and other spreadsheet programs) there are functions:
- SUMIF: takes a predicate, anda range, and adds up all items in the predicate that meet thepredicate.
- SUMPRODUCT: takes 2 column ranges, on each row multiples the element by the element next to it in ther other range, then adds all these up.
+-----+-----------------+------+------------------+ | qty | product | item | item per product | +-----+-----------------+------+------------------+ | 4 | box of foo | foo | 10 | | 8 | foo | foo | 1 | | 2 | box of bar | bar | 10 | | 1 | foorbar package | set | 1 | +-----+-----------------+------+------------------+
So I have an order list (basically inventory), of products. Each product contains one or more items. Most of the time is is just of a single typ of item. Except the foobar package which contains 1 foo and one bar.
I want to generate a table summerizing how many of each item we are ordering. which would like:
+------+----------------+ | Item | Net Qty | +------+----------------+ | foo | 49 (=4*10+8+1) | | bar | 29(=2*10+1) | +------+----------------+
The stuff in brackets is not part of the output table, just htereto make it clear where each number comes from.
How can I generate such a table? It seems like it could be acomplished by using If, Sum and Product. Using Ifs to make it count things that don't have the name of matching either the item I'm countering of the keyword "set", as zero, and then SUMPRODUCTING the result. But i[m not sure how to accomplish this in one line
I'm not very cluey about If, or doing complex things in spreadsheets in general
This is a one off thing so i don't want to go to the effort of creating a database, then exporting a speadsheet.