Sum of positive or negitive values only from a list

wallyxl

Board Regular
Joined
Apr 24, 2011
Messages
100
Is there a quick way to get the sum of only positive or negative numbers.
I have 21 columns, some cells will be positive and some will be negative, but none will be zero.
In column 22 I would like the sum of all the positive numbers and in column 23 the sum of all the negative.

Thank you.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi Mark,
Thanks for that, works great.
If anyone else is using this and you want to turn the negative to a positive just add x-1 at the end of the formula.
 
Upvote 0
If anyone else is using this and you want to turn the negative to a positive just add x-1 at the end of the formula.

Another way...
=ABS(SUMIF(A2:U2,"<0"))

and a macro if you want it...
Code:
Sub SumRng()
    Range("V2:V" & Range("A" & Rows.Count).End(xlUp).Row).FormulaR1C1 = "=SUMIF(RC[-21]:RC[-1],"">0"")"
    Range("W2:W" & Range("A" & Rows.Count).End(xlUp).Row).FormulaR1C1 = "=ABS(SUMIF(RC[-22]:RC[-2],""<0""))"
    With Range("V2:W" & Range("A" & Rows.Count).End(xlUp).Row)
        .Value = .Value
    End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,157
Messages
6,123,340
Members
449,097
Latest member
thnirmitha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top