Using the IF Function within Excel

LiamHems

New Member
Joined
Jan 21, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I am trying to work out a calculation within Excel and my values for 'arg' can lie anywhere between -10 and +10. Within a cell, I would like to work out how to use the IF Function to say:
If the value of 'arg' is greater than +1, then the value will be changed to +1. If the value is less than -1, then the value will be changed to -1 and if the value lies between -1 and +1, then the value would stay as the same

I hope this makes sense and some one can help me out with this query. Thank you very much!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
try this:
Excel Formula:
=MAX(-1,MIN(A1,1))
or
Excel Formula:
=IF(A1>1,1, IF(A1<-1,-1,A1))

where A1 is 'arg'

HTH
 
Upvote 0
Solution
delighted it works, if the second works then the first should work just as well :)
 
Upvote 0

Forum statistics

Threads
1,215,370
Messages
6,124,526
Members
449,169
Latest member
mm424

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