Sum only positive or negative numbers

M

MAX258

I have one column - M1:M68
I want to sum all positive numbers in the column in one cell
and then
I want to sum all negative numbers in the column in another cell

I have tried multiple sumifs and sumproducts.

Thank you in advance,
Ma
 
B

Bob Phillips

Max,

Positive

=SUM((M1:M68>0)*(M1:M68))

Negative

=SUM((M1:M68<0)*(M1:M68))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

Max,

Sorry, I forgot to mention that they are array formula, so you commit with
Ctrl-Shift-Enter, not just Enter.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

Andy B

Max

Looking at Bob's formula, I reckon you'll need to array-enter it. That is
instead of pressing Enter when you've typed it (or edited it) press Ctrl
Shift and Enter. The alternative is to use the same formula but use
SUMPRODUCT instead of SUM

Andy.
 
M

MAX258

Bob/Andy

Thanks again...but sill not working....is it possible my numbers aren'
formatted correctly or something like that
 
M

MAX258

O.K. guys I got it....

it is =sumif(M1:M68,"<0",M1:M68)

Had to enter the <0, or >0 in quotes " "


Thanks again for all of your help.
Ma
 
A

Andy B

Max

A couple of things to check. Make sure that you do not use a full column
reference (eg A:A) and make sure that both bits of the formula reference the
same number of cells each. What error are you getting, by the way?

Andy.
 
B

Bob Phillips

Spot-on!

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Andy B said:
Max

Looking at Bob's formula, I reckon you'll need to array-enter it. That is
instead of pressing Enter when you've typed it (or edited it) press Ctrl
Shift and Enter. The alternative is to use the same formula but use
SUMPRODUCT instead of SUM

Andy.
 
B

Bob Phillips

Andy and Max,

SUMIF (and COUNTIF) will both take a column reference, no need to specify
the row numbers unless the range to test is to be restricted.

Also, you only need =SUMIF(M1:M68,"<0"), the third argument is not required
if the summing range is the same as the range to be tested.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Andy B said:
Max

A couple of things to check. Make sure that you do not use a full column
reference (eg A:A) and make sure that both bits of the formula reference the
same number of cells each. What error are you getting, by the way?

Andy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top