MaximumGravity
New Member
- Joined
- Apr 16, 2002
- Messages
- 29
After a week of an excel blitzkreig, my mind has mushified. I am trying to find the easiest, most compact way to sum a 2nd column, based on the month value in the first column. I need this to break at every monthly change, and keep a running total for each month.
Here is an example:
Cell E2 is the formula that I am trying to calculate. In short, I want to SUMIF the MONTH() = 6. For E3 SUMIF MONTH() = 7, etc. Since this will be an ongoing datasheet, I need the month to be variable - in otherwords, only SUMIF A2 does not equal A3.
I am sure a LOOKUP() function would work, but the theory I have is to define a DYNAMIC RANGE using the OFFSET(A2,,COUNTA()) method, but the range would then have to DYNAMICALY reference itself - once A:A changed months.
I hope this makes sense. if further examples are needed, let me know. Also, I am not married to the calculations in Rows C & D - this is the pre-existing data that I have to work with. In short, B is a metered total, read from a daily print out. C is just the calculated difference to determine the daily consumption, and D is taken from the invoice that is billed to us for Gallons purchased. I think there may be a more fluid approach to these calculations.
Here is an example:
GAS OO Modified.xls | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Date | TANKINVENTORY | CALCULATEDCONSUMPTION | INVENTORIEDFILL | MTDInventoriedConsumed | ||
2 | 6/1/2004 | 2108.0 | 90.0 | 0 | |||
3 | 6/2/2004 | 2018.0 | 106.0 | ||||
4 | 6/3/2004 | 1912.0 | 117.0 | ||||
5 | 6/4/2004 | 1795.0 | 947.0 | ||||
6 | 6/5/2004 | 2742.0 | 45.0 | ||||
7 | 6/6/2004 | 2697.0 | 72.0 | ||||
8 | 6/7/2004 | 2625.0 | 175.0 | ||||
INVENTORIED TOTALS |
Cell E2 is the formula that I am trying to calculate. In short, I want to SUMIF the MONTH() = 6. For E3 SUMIF MONTH() = 7, etc. Since this will be an ongoing datasheet, I need the month to be variable - in otherwords, only SUMIF A2 does not equal A3.
I am sure a LOOKUP() function would work, but the theory I have is to define a DYNAMIC RANGE using the OFFSET(A2,,COUNTA()) method, but the range would then have to DYNAMICALY reference itself - once A:A changed months.
I hope this makes sense. if further examples are needed, let me know. Also, I am not married to the calculations in Rows C & D - this is the pre-existing data that I have to work with. In short, B is a metered total, read from a daily print out. C is just the calculated difference to determine the daily consumption, and D is taken from the invoice that is billed to us for Gallons purchased. I think there may be a more fluid approach to these calculations.