IF I4 is positive than i want to subtract I4-J4 but if I4 is negative than add I4+J4

PhilipeC

Board Regular
Joined
May 1, 2018
Messages
56
IF I4 is positive than i want to subtract I4-J4 but if I4 is negative than add I4+J4?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
IF I4 is positive than i want to subtract I4-J4 but if I4 is negative than add I4+J4?
You did not say what should happen if I4 equal 0, but give this a try...

=IF(I4>0,I4-J4,I4+J4)
 
Last edited:
Upvote 0
The formula is adding when there a positive number in I4 but when there a negative number, it still adding instead of subtracting.
 
Upvote 0
The formula is adding when there a positive number in I4 but when there a negative number, it still adding instead of subtracting.

What should the result be for each of the following values...
[table="width: 500"]
[tr]
[td]I4[/td]
[td]J4[/td]
[td]Result[/td]
[/tr]
[tr]
[td]100[/td]
[td]50[/td]
[td][/td]
[/tr]
[tr]
[td]0[/td]
[td]50[/td]
[td][/td]
[/tr]
[tr]
[td]-100[/td]
[td]50[/td]
[td][/td]
[/tr]
[/table]
 
Upvote 0
I4----J4 Result

100---50 -----> 100 - 50 = 50

0---50 ---> 0 + 50 = 50

-100---50 ---> - 100 - 50 = -150
 
Last edited:
Upvote 0
I4----J4 Result

100---50 -----> 100 - 50 = 50

0---50 ---> 0 + 50 = 50

-100---50 ---> - 100 - 50 = -150

J4 is +50 for each scenario that I asked about. Your thread title say...

"but if I4 is negative than add I4+J4"

Why do you show -100 - 50 when your thread title show +J4 for this condition?
 
Upvote 0
Yes, Sorry about that , my answer was badly written. The previous formula had worked, Thank you
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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