ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Summing cells based on run-time criteria (https://www.excelbanter.com/excel-programming/271507-summing-cells-based-run-time-criteria.html)

Jim Martin

Summing cells based on run-time criteria
 
I'm would like to sum values in a range in column "C" that is determined by
a value in the first column, say for example:

1 5/1/03 12345
1 5/2/03 14452
1 5/3/03 9142 35939
2 5/4/03 18265
2 5/5/03 10256 28521
3 5/6/03 11024
3 5/7/03 8148 19172
4 5/8/03 20110 20110
5 5/9/03 10110
5 5/10/03 9186
5 5/11/03 10123
5 5/12/03 6842 36261

I would like to enter a formula in all of the cells in column "D" that will
calculate the sum (in the same row as the last item of column "A", but only
in that row) for all the values in column "A" that are the same, such as
C1:C3, C4:C5, C6:C7, C8, and C9:C12. I know this must be possible, but I've
tried a lot of functions with no luck at all. I'd rather not run a macro, if
I can get around it, unless it will run automatically as the data is added.
Thanks for your help and best regards!



Bob Phillips[_5_]

Summing cells based on run-time criteria
 
Jim,

Put this formula in D1, exactly as shown with the $ signs, and copy down
column D
=IF(COUNTIF($A$1:$A$12,$A1)=1,SUMIF($A$1:$A$12,$A1 ,$C$1:$C$12),"")

Adjust the $A$12 to wherever your rows really end.

--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Jim Martin" wrote in message
...
I'm would like to sum values in a range in column "C" that is determined

by
a value in the first column, say for example:

1 5/1/03 12345
1 5/2/03 14452
1 5/3/03 9142 35939
2 5/4/03 18265
2 5/5/03 10256 28521
3 5/6/03 11024
3 5/7/03 8148 19172
4 5/8/03 20110 20110
5 5/9/03 10110
5 5/10/03 9186
5 5/11/03 10123
5 5/12/03 6842 36261

I would like to enter a formula in all of the cells in column "D" that

will
calculate the sum (in the same row as the last item of column "A", but

only
in that row) for all the values in column "A" that are the same, such as
C1:C3, C4:C5, C6:C7, C8, and C9:C12. I know this must be possible, but

I've
tried a lot of functions with no luck at all. I'd rather not run a macro,

if
I can get around it, unless it will run automatically as the data is

added.
Thanks for your help and best regards!






All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com