how to return zero if formula returns a negative

Dylan driscoll

New Member
Joined
Apr 14, 2013
Messages
9
I'm currently using the following formula to return zero if M3=0.
=IF(AND(M3=0),0,(M3-S3)*(A3-0.58)).
How can I modify this to also return zero if (M3-S3)*(A3-0.58) is a negative.
Thanks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You can use the MAX function like this...

=MAX(0,IF(AND(M3=0),0,(M3-S3)*(A3-0.58)))

but I am wondering why you have AND(M3=0) as the first argument to the IF function... why are you using AND when there is only one logical expression as its argument?
 
Upvote 0
I've only been using excel for a week and this was the first formula that returned the result I was after.
before you replied I got it to work like this =IF(AND(M3=0),0,IF(AND((M3-S3)*(A3-0.58)<0),0,(M3-S3)*(A3-0.58)))
I guess there is a shorter way to write the same :confused:
I'll go back and try to use the =max
 
Upvote 0
The reason I used AND(M3=0),0, is because when M3 is a zero the formula is multiplying a negative by a negative which is obviously a positive. In this case it means an employee being paid extra when he did not work, AND(M3=0),0, stops this from happening
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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