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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
=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,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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