How to use the IF statement?

mon_751

New Member
Joined
Feb 19, 2016
Messages
4
I created two columns with random numbers, however in the next column I want to use an if statement. For instance if the number in the specific column and row is between 1 and 2 I want it to output a "1". Likewise if a number is between 3 and 4 I want it to output a "2" and so on until I get to "6" (since I am working on dice problem), How can I do this in excel?
I've tried using the following IF(AND statement various ways but it won't work, it gives me a #VALUE maybe because I have nothing to put for when the value is false like it asks for.

IF(AND(A1>=0,A1<=1),1,IF(AND(A1>1,A1<=2),2... so on
IF(A1=0,"1"), IF(A1=1,"1"), IF(A1=2,"2"),...so on

Thanks in advanced! Any help is appreciated
 

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).
thank you that seems to work! By any chance do you know how to input decimals into it? like a number between 7 and 7.5. I've tried doing =IF(A1<=7,5,IF(A1>=7.5,5) but it won't take my numbers correctly as decimals.
 
Upvote 0
I do not understand what you are trying to achieve, what is the actual formula you need?

The suggested formula in #2 reads:

If A1 is < 3 (i.e. 2, 1.5, 1, 0.5, 0, -0.5, -1, -1.5, -2 etc) then return 1.

Else If A1 < 5 (if it's not less than 3, it has to be greater than or equal to 3 - i.e. 3, 3.5, 4. 4.5 BUT < 5), then return 2.

Otherwise for anything else (i.e. >=5), return 3.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

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