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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
you can also use this.

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

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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