Skip to main content
1-Visitor
November 19, 2021
Solved

Sum of positive values in vector and sum of negative values in a vector

  • November 19, 2021
  • 1 reply
  • 3377 views

I have created a vector that has both positive and negative values.

 

I would like to sum all the positive values, return the number, and then separately sum the negative numbers and return the number.

 

Is this possible?

 

RH_9815461_0-1637322354949.png

Thanks, 

 

Ross 

Best answer by LucMeekes

Preferrably you should attach your Prime worksheet AND state which version of Prime you are using.

Apart from that, how about this...

LucMeekes_0-1637325257359.png

Attached is a Prime 4 file, with the advice from @Werner_E (see below).

 

Success!
Luc

1 reply

LucMeekes23-Emerald IVAnswer
23-Emerald IV
November 19, 2021

Preferrably you should attach your Prime worksheet AND state which version of Prime you are using.

Apart from that, how about this...

LucMeekes_0-1637325257359.png

Attached is a Prime 4 file, with the advice from @Werner_E (see below).

 

Success!
Luc

25-Diamond I
November 19, 2021

You don't even need the summation operator

Werner_E_1-1637325727922.png

 

23-Emerald IV
November 19, 2021

Hmm...

LucMeekes_0-1637325866422.png

gives:

LucMeekes_1-1637325877998.png

I think I prefer to have it in.

 

Or...

LucMeekes_2-1637326068388.png

Now it works:

LucMeekes_3-1637326087500.png

 

Luc