Difference between positive negative (any variation)

roondog248

New Member
Joined
Aug 21, 2014
Messages
7
----->​

<colgroup><col style="width: 75px"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"></colgroup><tbody>
[TD="colspan: 3, align: center"]Score[/TD]
[TD="colspan: 3, align: center"]Yards/Point[/TD]
[TD="colspan: 3, align: center"]Yards / Play[/TD]

[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]

[TD="colspan: 2, align: center"]Chicago Bears[/TD]
[TD="align: center"]23.0[/TD]
[TD="align: center"]25.0[/TD]
[TD="align: center"]-2.0[/TD]
[TD="align: center"]15.2[/TD]
[TD="align: center"]14.9[/TD]
[TD="align: center"]0.3[/TD]
[TD="align: center"]5.3[/TD]
[TD="align: center"]6.2[/TD]
[TD="align: center"]-0.9[/TD]

[TD="colspan: 2"][/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]21[/TD]
[TD="align: center"]21[/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]21[/TD]
[TD="align: center"] 28 [/TD]
[TD="align: center"] 31 [/TD]

[TD="colspan: 2, align: center"]Carolina Panthers[/TD]
[TD="align: center"]18.3[/TD]
[TD="align: center"]24.0[/TD]
[TD="align: center"]-5.8[/TD]
[TD="align: center"]18.0[/TD]
[TD="align: center"]15.6[/TD]
[TD="align: center"]2.4[/TD]
[TD="align: center"]5.3[/TD]
[TD="align: center"]6.0[/TD]
[TD="align: center"]-0.6[/TD]

[TD="align: center"] 28 [/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]27[/TD]
[TD="align: center"]27[/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]21[/TD]
[TD="align: center"]23[/TD]
[TD="align: center"]23[/TD]
[TD="align: center"]25[/TD]

[TD="align: right"]----->[/TD]
[TD="align: center"]3.8[/TD]
[TD="align: center"] 2.1 [/TD]

[TD="align: center"]0.2[/TD]

</tbody>



All the metrics under Offense & Defense are the result of a vlookup formula, so they change everytime depending on the team.
In the +/- column, (difference between the differences) both of the numbers will sometimes be positive, sometimes negative, sometimes positive & negative.

As you can see, the number (in red) in the H column is incorrect.
I need help figuring out a formula that will retain all the rules for subtracting positive, negatives (every variation)
Any help would be greatly appreciated.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
As you can see, the number (in red) in the H column is incorrect.
1. I can only see that for certain if you clearly point out what the correct result should be and how you calculate that correct result.

2. Is the "0.2" at the bottom right of your table correct? If so, how was it calculated? If not, what should it be, and why?
 
Upvote 0
----->​
----->​
----->​

<colgroup><col style="width: 75px"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"></colgroup><tbody>
[TD="colspan: 3, align: center"]Score[/TD]
[TD="colspan: 3, align: center"]Yards/Point[/TD]
[TD="colspan: 3, align: center"]Yards / Play[/TD]

[TD="align: center"]Net Yards/Pass[/TD]

[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]

[TD="colspan: 2, align: center"]New York Jets[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-4.3[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-6.4[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]0.7[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]0.3[/TD]

[TD="colspan: 2"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="colspan: 2, align: center"]San Diego Chargers[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]9.8[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-6.9[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-0.1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]2.1[/TD]

[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: right"]----->[/TD]
[TD="align: center"]14.0[/TD]
[TD="align: center"]0.5[/TD]
[TD="align: center"]0.8[/TD]
[TD="align: center"]1.8[/TD]

</tbody>

in order to make this less confusing refer to this one, b/c it has only the values in question.

All the values with the arrow next to them are correct. I worked them out on a calculator.
1st column of number is - - +
2nd is - - -
3rd is + - -
4th is + - +

all these numbers will change every time i enter a new team. So the only thing i can think of is 3 or 4 nested If formulas that apply all the rules of subtracting positives and negatives.
 
Upvote 0
After many many hours of aggravation I think I have just figured it out.
As I attempted to articulate the comment that would respond to yours, I had to think about all the rules of subtracting positive and negative numbers and any variation (+ - +) (- - +) (+ - -) + - +) and then transfer those rules to Excel talk.

I think I have figured it out....

=IF(AND(E17>0,E19>0),MIN(E17,E19)-MAX(E17,E19),IF(AND(E17<0,E19<0),(ABS(E17-E19)),IF(AND(E17>0,E19<0),MAX(E17,E19)-(MIN(E17,E19)),MIN(E17,E19)-(MAX(E17,E19)))))

I'm sure I will find a few flaws in this formula as the values change with the teams.
Hopefully I will be able to adjust.

If anyone sees a flaw, or has an easier way, let me know.

thanks
 
Upvote 0
I'd still ask for the rules. Try to make an exhaustive set of examples along with the manually calculated desired results.
 
Upvote 0
I think I have figured it out....

=IF(AND(E17>0,E19>0),MIN(E17,E19)-MAX(E17,E19),IF(AND(E17<0,E19<0),(ABS(E17-E19)),IF(AND(E17>0,E19<0),MAX(E17,E19)-(MIN(E17,E19)),MIN(E17,E19)-(MAX(E17,E19)))))

If anyone sees a flaw ...
Yes, I see a flaw, though I don't know if it's a flaw in your formula or a flaw in the red statement below.
The flaw is that the formula above and the red statement below cannot both be correct because the formula does not produce the values you state are correct, as evidenced by my screen shot below.
Hence the need for an accurate response to Aladin's request.

----->​
----->​
----->​

<colgroup><col style="width: 75px"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"><col width="75"></colgroup>
[TD="colspan: 3, align: center"]Score[/TD]
[TD="colspan: 3, align: center"]Yards/Point[/TD]
[TD="colspan: 3, align: center"]Yards / Play[/TD]

[TD="align: center"]Net Yards/Pass[/TD]

[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]
[TD="align: center"]Offense[/TD]
[TD="align: center"]Defense[/TD]
[TD="align: center"]+/-[/TD]

[TD="colspan: 2, align: center"]New York Jets[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-4.3[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-6.4[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]0.7[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]0.3[/TD]

[TD="colspan: 2"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="colspan: 2, align: center"]San Diego Chargers[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]9.8[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-6.9[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]-0.1[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]2.1[/TD]

[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

[TD="align: right"]----->[/TD]
[TD="align: center"]14.0[/TD]
[TD="align: center"]0.5[/TD]
[TD="align: center"]0.8[/TD]
[TD="align: center"]1.8[/TD]


All the values with the arrow next to them are correct. I worked them out on a calculator.
1st column of number is - - +
2nd is - - -
3rd is + - -
4th is + - +

all these numbers will change every time i enter a new team. So the only thing i can think of is 3 or 4 nested If formulas that apply all the rules of subtracting positives and negatives.

Excel Workbook
CDEFGHIJKLMN
17-4.3-6.40.70.3
18
199.8-6.9-0.12.1
20
21Stated as correct----->14----->0.5----->0.8----->1.8
22
23Post #7 formula:-14.10.50.8-1.8
roondog248
 
Upvote 0
you're right, that formula is inaccurate.
I'm not sure what you want me to explain.
i'm looking for the formula to find the difference between the two numbers, whether that is positives - negatives, negatives - negatives, positives - positives.
With all due respect, I think those rules are common knowledge.

I will have to adjust those flaws late on today after work.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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