Sum a column that has positive and negative values

julhs

Active Member
Joined
Dec 3, 2018
Messages
471
Office Version
  1. 2010
Platform
  1. Windows
I’m flummoxed as to the correct formula that I need to return the expected/desired result.
“Total Owed” in D18 is the desired outcome but “Total Owed” in H14 is not giving the expected/desired result.
All data is entered as numbers and not text formatted as a number.
Accounts 2016 - 2019 Final Currant Master New New (Autosaved).xlsm
ABCDEFGHI
1
2
3
4
510.00-10.00
690.2190.21
789.9589.95
889.9589.95
9250.00-250.00
1089.9589.95
11126.19126.19
1289.9589.95
1350.0050.00
14886.20Total owed366.20
15
16-10.00
17-250.00
18Total owed626.20
19
20
Sheet3
Cell Formulas
RangeFormula
D14,H14D14=SUM(D5:D13)
D18D18=SUM(D14:D17)
 
This is post has not gone terribly well due to my poor explanation and example data.
How right you are Joe!
The formulas are all solid. Your logic/understanding is just a little faulty.
Maybe when you come back to it tomorrow with fresh eyes it will be more clear to you.

So with pointers from everyone and research, I figured out how to resolve my issue.
The problem I was trying to resolve was caused by the mistake I made of applying "-" identifiers to some values in "H5:H13" and thinking that a straight forward "Sum" of the column would give me the Total of 626.20 (So a case of me NOT understanding how SUM evaluated the "-" values)
I researched further and it was as simple as using the below that now gives me the intended value of 626.20
Excel Formula:
=SUMIF(H5:H13,">0")
Thanks everyone for their input.
Julhs
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Thanks for the explanation. I'm curious...are the values actually negative, or did you just happen to make the unfortunate choice to use a hyphen (subtraction operator or negative sign) as the character for flagging certain positive values that should be ignored? Some other options: you could use nearly any other text character in front of the value, and that causes Excel to treat the cell contents as text, so it would be ignored by the SUM function (see column F, where SUM is used...or SUMIF if you prefer). Alternatively, and probably preferred because it is easy to inspect and doesn't change the original cell values, you could use a helper column to identify values that should be ignored, and flag those values with some character (see columns H:I where the letter "z" is used and then SUMIF is used to ignore any values on rows where "z" appears in column H).
MrExcel_20240131_C (version 1).xlsx
CDEFGHI
4IgnoreValues
5-10.00x10z10.00
690.2190.2190.21
789.9589.9589.95
889.9589.9589.95
9-250.00x250z250.00
1089.9589.9589.95
11126.19126.19126.19
1289.9589.9589.95
1350.0050.0050.00
14Sum366.20626.20626.20
15Desired Sum ignores negative values626.20
16
17Sum only positive values626.20626.20
Sheet6
Cell Formulas
RangeFormula
D14,F14D14=SUM(D5:D13)
I14I14=SUMIF(H5:H13,"<>z",I5:I13)
D17,F17D17=SUMIF(D5:D13,">0")
 
Upvote 0
Kirk
The values are ONLY negative because I (naively) thought that by MANUALLY making them so was the way to subtract their value in my ORIGINAL "Sum" formula.
As I said in #11,
(So a case of me NOT understanding how SUM evaluated the "-" values)
I have NO doubt that what you have provided would work; but as I have had to resort to other "Helper" columns (for other reasons, primarily due to my lack of knowledge) that I’m reluctant to add any more when;
Excel Formula:
=SUMIF(H5:H13,">0")
works for me without a further helper column to achieve what I'm trying to do in this senario.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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