View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Herbert Seidenberg Herbert Seidenberg is offline
external usenet poster
 
Posts: 1,180
Default PivotTable Calculations

Assume your data looks like this:
Date Item Source Destination Qty
20-2-07 Item1 Bin1 Bin2 16
20-2-07 Item1 Bin1 Bin2 21
21-2-07 Item1 Bin2 Bin3 10
21-2-07 Item2 Bin1 Bin2 28
20-2-07 Item2 Bin1 Bin2 17
21-2-07 Item2 Bin2 Bin1 26
21-2-07 Item1 Bin3 Bin1 22
20-2-07 Item2 Bin3 Bin2 30
20-2-07 Item1 Bin1 Bin3 23
20-2-07 Item2 Bin3 Bin1 25

Create 2 Pivot Tables, for Gain and Loss.
Gain might look like this:

Item (All)
Gain Date
Destination Source 20-2-07 21-2-07 Grand Total
Bin1 Bin1
Bin2 26 26
Bin3 25 22 47
Bin1 Total 25 48 73
Bin2 Bin1 82 82
Bin2
Bin3 30 30
Bin2 Total 112 112
Bin3 Bin1 23 23
Bin2 10 10
Bin3
Bin3 Total 23 10 33

Layout:
ROW = Destination, Source
COLUMN = Date
DATA = Sum of Qty (relabel Gain)
PAGE = Item
Options:
Grand Totals for Rows
Click on Destination/Source. For both Field Settings:
Subtotals: Automatic
Show items with no data


Create the Loss Pivot Table:
Same as Gain, but with
ROW = Source, Destination

Create this:
NetGain
Bin1 -32
Bin2 76
Bin3 -44

To create the first formula (-32), click on (Grand Total)
of (Bin1 Total) of Gain (73) and subtract the corresponding
cell at Loss (105).
You can select the items and dates of interest from
the drop down lists.