Subtract Positive and Negative Values (+/- numbers in same column)

flare9x

Board Regular
Joined
Jan 29, 2016
Messages
120
Hello

This is what i am trying to achieve:

In column: AU I have the net total of various numbers. Sometimes the net number is positive other times negative.

I want to know the difference between Column AT and AS.....

So this is what I have tried:

=AS-AT

Problem with this: if AT is a negative number and AS is positive it adds to make a negative... Not what im looking for, the answer should be: -8.70.

AS AT AU (net)
1.98-10.68-12.66
-1.062.20-3.26
9.53-3.076.46
6.070.185.89
3.901.212.69
3.79-0.353.44
-5.750.22-5.97
1.294.96-3.67
-9.64-7.33-16.97
11.224.746.48
-0.041.86-1.90
7.02-5.711.31
3.474.06-0.59
-1.91-1.78-3.69
4.691.413.28
3.65-2.740.91
-0.11-3.75-3.86
6.09-1.294.80
-8.28-3.91-12.19
5.573.002.57
5.294.470.82
0.887.12-6.24
-0.89-1.60-2.49
0.792.73-1.94

<colgroup><col width="64" span="2" style="width:48pt"><col width="64" style="width:48pt"></colgroup><tbody>
</tbody>

<colgroup><col width="64" span="2" style="width:48pt"><col width="64" style="width:48pt"></colgroup><tbody>
</tbody>


I then try this: =AS2-ABS(AT2)
Problem: This works with AT being negative number and AS being positive... the result is correct at -8.70.
However the problem then goes on IF: AS is negative value and AT positive.... the numbers are added to create -3.26 which is errorsome, the correct value should be 1.14

AS AT AU (Net)
1.98-10.68-8.70
-1.062.20-3.26
9.53-3.076.46
6.070.185.89
3.901.212.69
3.79-0.353.44
-5.750.22-5.97
1.294.96-3.67
-9.64-7.33-16.97
11.224.746.48
-0.041.86-1.90
7.02-5.711.31
3.474.06-0.59
-1.91-1.78-3.69
4.691.413.28
3.65-2.740.91
-0.11-3.75-3.86
6.09-1.294.80
-8.28-3.91-12.19
5.573.002.57
5.294.470.82
0.887.12-6.24
-0.89-1.60-2.49
0.792.73-1.94

<colgroup><col width="64" span="2" style="width:48pt"><col width="64" style="width:48pt"></colgroup><tbody>
</tbody>


I then try this: =AT2-ABS(AS2)
Problem with this: If AT2 is negative, then it adds the positive to make a deeper negative: -12.66. However, this works when the AS column is a negative value.... the formula is correct and gives correct value of 1.14.

1st hour Last HourNet
1.98-10.68-12.66
-1.062.201.14
9.53-3.07-12.60
6.070.18-5.89
3.901.21-2.69
3.79-0.35-4.14
-5.750.22-5.53
1.294.963.67
-9.64-7.33-16.97
11.224.74-6.48
-0.041.861.82
7.02-5.71-12.73
3.474.060.59
-1.91-1.78-3.69
4.691.41-3.28
3.65-2.74-6.39
-0.11-3.75-3.86
6.09-1.29-7.38
-8.28-3.91-12.19
5.573.00-2.57
5.294.47-0.82
0.887.126.24
-0.89-1.60-2.49
0.792.731.94

<colgroup><col width="64" span="2" style="width:48pt"> <col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>



Has anyone got the answer? Im thinking along the lines of
=if AS is >0 value and AT<0 value then =AS2-ABS(AT2) IF NOT then... =AT2-ABS(AS2)

Thanks for any help
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I want to know the difference between Column AT and AS.....

So this is what I have tried:

=AS-AT

Problem with this: if AT is a negative number and AS is positive it adds to make a negative... Not what im looking for, the answer should be: -8.70.
Can you explain in plain English the logic? Is a negative number really not a negative number (or least for the purposes of what you are trying to do)?

Because in pure mathematical terms,
=AS - AT
is correct and -12.66 is the expected result (and correct, mathematically).
 
Upvote 0
Im only interestd in the difference between AT and AS so its important that if AS is a positive value that this the net result
1.98-10.68-8.70

<tbody>
</tbody>

etc...
 
Upvote 0
So, how about:
=ABS(AS2)-ABS(AT2)
 
Upvote 0
I see you reference "1st Hour" and "Last Hour" in one of your tables.
Is there a time component involved in these values? If so what.

In strictest terms the difference between two numbers has no sign.
The difference From a number to another number does. It has a vector or direction.
 
Upvote 0
I see you reference "1st Hour" and "Last Hour" in one of your tables.
Is there a time component involved in these values? If so what.

In strictest terms the difference between two numbers has no sign.
The difference From a number to another number does. It has a vector or direction.

Ok I am going to plot the last hour column into a chart.
Im trying to measure the change in the last hour and compare it to the change in the first hour. A positive number would then mean that the last hour outperformed the fisrt hour.
 
Upvote 0
So, did my last suggestion do what you need?
 
Upvote 0
It works for when AT is a negative value. However, if AS i negative and AT positive, it doesnt work, thanks for helping
 
Upvote 0
It works for when AT is a negative value. However, if AS i negative and AT positive, it doesnt work, thanks for helping
Maybe:
=IF(AT2>AS2,ABS(AT2)-ABS(AS2),ABS(AS2)-ABS(AT2))


Edit: looks like SpillerBD may be understanding what you are after, and it is not as complex as it is being made out to be!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,973
Members
449,200
Latest member
Jamil ahmed

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