Subtotaling minus negative numbers and posative numbers
With a macro
Sub sonic()
Set myrange = Range("A2:A9")
myrange.SpecialCells(xlVisible).Select
For Each c In Selection
If c.Value < 0 Then
negtot = negtot + c.Value
Else
postot = postot + c.Value
End If
Next
MsgBox (negtot)
MsgBox (postot)
End Sub
Note if you go this route you could wrte the results to a cell on your sheet
and you should include some error checks for text values.
Mike
"lehigh46" wrote:
Hi All,
I have a column with a mix of positive and negative numbers.
What Subtotal formulas can I use to sum only the positive numbers and
a second formula below the first one to show negative numbers.
This column will be auto filtered so I need a "Subtotal" function.
Thanks for your help
Tom
|