Multiple Conditions - Greater than less than

Scarebare

New Member
Joined
Mar 4, 2024
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
Hi – I have a series of numbers is cells A1- D4. say 44, 16, 10, 5

I would like to be able to write a formula that returns the following answers.

1. If "A1" is between 10 and 20 then i want to be able to take the difference above 10 away from 10. ie If A1 is say 15 then i want to produce an answer that is '5" (10-(15-10)
2. For number greater than 20 I want to return a zero value.
3. If A1 is < 10, A1
4. If A1 =10, A1.

So in the case of the numbers i provided above in A1 would equal 0, B1 = 6, C1=10 & D1 = 5
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Welcome to the MrExcel board!

Please ignore the above - solved - Thanks ChatGPT !!!
Care to share that solution to assist other readers?


If "A1" is between 10 and 20 then i want to be able to take the difference above 10 away from 10.

So in the case of the numbers i provided above ... B1 = 6
:confused: Perhaps I have mis-interpreted what you wrote but that seems contradictory to me.
For the number 16, the difference above 10 to me is 6. If take that away from 10 you get 4, not 6. 10-(16-10)
 
Upvote 0
I agree that 4 should be correct for that.
Here is my formula anyway:
=IF(A1>20,0,MIN(A1,(10-(A1-10))))

Book1
ABCD
14416105
204105
Sheet1
Cell Formulas
RangeFormula
A2:D2A2=IF(A1>20,0,MIN(A1,(10-(A1-10))))
 
Upvote 0
Welcome to the MrExcel board!


Care to share that solution to assist other readers?



:confused: Perhaps I have mis-interpreted what you wrote but that seems contradictory to me.
For the number 16, the difference above 10 to me is 6. If take that away from 10 you get 4, not 6. 10-(16-10)
Yes, you are correct - it was my bad.
Chatgp gave me this which works well: =IF(J13 > 20, 0, MAX(0, IF(J13 >= 10, 10 - (J13 - 10),J13)))
 
Upvote 0
Chatgp gave me this which works well: =IF(J13 > 20, 0, MAX(0, IF(J13 >= 10, 10 - (J13 - 10),J13)))
Thanks for that. Although that works, you can see that there are considerably shorter options. :)

BTW, is it possible for the original number to be negative? If so, what should the result be (examples)?
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,629
Members
452,661
Latest member
Nonhle

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