Does execute2 suggestion not enough ? What function is missing ? Or write what you want in pseudo-code and It would be possible to really tell you precisely how it translates in Excel (sorry I'm a bit slow also because I still don't understand what you need exactly

)
See also
http://www.exceltip.com/excel_tips/Summing/104.html
Summing Tips - All Tips (17 tips)
Totaling Rounding numbers in Microsoft Excel
Summing values in a vertical range in Microsoft Excel
Summing values in vertical and horizontal ranges in Microsoft Excel
Summing data by selecting cells in Microsoft Excel
Sum subtotals in Microsoft Excel
Extending the range of sums for the SUM formula in Microsoft Excel
AutoSum, additional functions in Microsoft Excel
Summing data in the intersection of two ranges in Microsoft Excel
Summing data from a cell in a number of sheets in Microsoft Excel
Sumif - using comparison operators (< >) as criteria in Microsoft Excel
Using SUMIF to sum two ranges according to criteria in Microsoft Excel
Summing totals with text characters as criteria in Microsoft Excel
Summing filtered data in Microsoft Excel
Summarize data according to criteria from the data table using Sumif formula, Offset formula and Combo Box in Microsoft Excel
Summing a range containing errors and values in Microsoft Excel
Summing using multiple criteria in Microsoft Excel
Sum the largest two numbers in range in Microsoft Excel
Quote from ElectricSavant:
I have one column showing a combo profit OR loss in currency. I want to show another cell off to the right just totaling the wins and another cell showing just the losses using the values from that one column. Attached is what I have so far....
Michael B.