Help with RAND() problem. Usinf IF and AND.

Val4050

New Member
Joined
Feb 15, 2015
Messages
1
Dear Forum

I would be very grateful for some help as I just cannot get the correct output from using RAND().

If I enter in any cell the following I had expected to get just 2 results. In this case just a "<5" or ">5".

What I dont understand is why there is a third. Why is the false being used?

Here I've just entered some more text for the FALSE "Why is this here?". Its probably straigthforward but I've drawn a blank and would be grateful for some help.

=IF(AND(RAND()>=0,RAND()<=0.5),"<5",IF(AND(RAND()>0.5,RAND()<=1),">5","Why is this here?"))

In short if RAND() is between 0 and 1 how do I filter the outcomes: 0-0.2; 0.2-0.4; 0.4-0.6; 0.6-0.8; 0.8-1.0 without overlaps?

Thank you in advance
V.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
=IF(AND(RAND()>=0,RAND()<=0.5),"<5",IF(AND(RAND()>0.5,RAND()<=1),">5","Why is this here?"))

The two underlined functions are different numbers (enter =RAND() & ", " & RAND() to see what I mean)

try
=LOOKUP(RAND(),{0,0.2,0.4,0.6,0.8,1},{"0-2","2-4","4-6","6-8","8-10"})
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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