Return number as 0 if negative AND as another cell if over.

Lmaonade

Board Regular
Joined
Jan 5, 2018
Messages
52
Hi guys,

I have a spreadsheet. In one of the colomns I need the sum calculation to return 0 if it's negative and if it's over a certain number then I need it to return as that number as a maximum.

Example:

Cell A1 is 10,
Cell B1 is 12,

In Cell C1 I want to put a formula that tells me A1 minus B1. If the number is negative (Which is would be) I want it to return 0. which I'm thinking would just be as simple as =IF(A1-B1<0,0,A1-B1),But I want another rule in this cell that says if the number returned is higher than a number in D1 (Let's say for example that number is 8) Then I want the number to return as 8. Basically whatever number is in D1 I want that to be the maximum number C1 returns.

I'm sorry if I'm not explaining myself well.

Any help would be appreciated.

Thanks,
Andy
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
you can also use this.

=MEDIAN(0,A1-B1,D1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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