Reputation: 45
I have two columns and want to calculate difference between the two columns (ie B1-A1) in Excel. However I only want to indicate whether the difference is positive or negative in third column.
A sample of my data in Excel looks like this:
8438 8510
3709 3181
Here I want to calculate the difference between two columns using formula C1 =(B1-A1)
But I want to only indicate the sign as shown below:
8438 8510 +
3709 3181 -
Please advise?
Upvotes: 1
Views: 133
Reputation: 46710
Just use an IF statement that returns the sign you want. For example
=IF(A1 > B1,"+","-")
Upvotes: 1
Reputation: 2443
You'll want to use the IF()
function, it takes three parameters:
=IF([condition], [result if true], [result if false])
So your example would be:
=IF(B1 > A1, "+", "-")
Upvotes: 0
Reputation: 14764
I think you should just use Number Formatting.
Select all of column C by clicking its column header.
Right-click and select Format cells...
.
Click on the Number
tab and select Custom
from the list on the left.
In the Type:
field enter this: +;-
Click OK.
That's it. Now when you use YOUR formula in column C, the numeric answer will display exactly has you have envisioned.
Upvotes: 0