Google spreadsheets - How to sum all negative or positive numbers in a range

So I recently wanted to sum all the negative and positive numbers in a range before adding them together. This was to see the total earnings and the total expenses, instead of only having the overall total. The problem was that they were all mixed up in a long list, so I could not easily do two simple SUM statements. What I ended up with was using the SUMIF function in two statements:

One for negative numbers:

=SUMIF(B1:B6, "<0")

and one for positive numbers:

=SUMIF(B1:B6, ">0")

Depending on your locale you may have to change the comma (,) to a semicolon (;).

The above is quite self explanatory, SUMIF takes a range and a condition on when cells should be part of the summation. For the first one (negative) it has to be below zero and for the second one (positive) it has to be above zero. This can give you the following result when you make the two summations using the above:

Google spreadsheet sum negative or positive numbers

I hope this helps you to do your summations, I found this way harder to figure out than it should be :)