Forum Discussion
Excel Formula
Please help, I cannot find this formula for the following:
I need the difference between these 2 data points: example
-100 to 438, the difference would be a positive 538.
438 to -100, the difference would be a negative 538
I've used ABS in the formula but that does not work in every situation. I want to copy this formula so I can use it in all cells. Going crazy here, ha.
8 Replies
- TwifooSilver Contributor
- D_McClure2020Copper Contributorcorrect, but when I use that formula in a line item when they are both negative, it does not work.
- mathetesGold Contributor
"does not work" does not describe what does happen...
What does happen? I would assume that when both numbers are negative it still would give you the absolute difference, the question being whether that movement from one to the other was positive or negative depending on which came first.
So another solution to the whole thing would be to use ABS to calculate the difference and then nest that within an IF that determines the direction.
In short, I think we may all need a clearer description of the context here, what you're actually trying to accomplish and the purpose.
- PReaganBronze Contributor
Hello D_McClure2020,
Let's say that cell A1=438, B1=-100, A2=-100, B2=438.
Then cell C1:
=A1-B1
Copy formula down to C2:
=A2-B2
Is this what you're looking for?
- D_McClure2020Copper Contributorsorry, no, that's just the simple subtraction that gives me the difference.
- D_McClure2020Copper Contributorwait, I think I got it to work....thanks everyone.
- mathetesGold Contributor
- PReaganBronze Contributor
The difference in sign comes from the reversal of the position of A1 and B1 in your formula. Whether D_McClure2020 should use =A1-B1 or =B1-A1 depends on the result that they are after.