سؤال

I'm trying to use RANDBETWEEN(1,11) but omit 6 and then drag it down. I don't know how to keep excel from including 6 as a random result?

هل كانت مفيدة؟

المحلول

maybe something like this:

=CHOOSE(RANDBETWEEN(1,2),RANDBETWEEN(1,5),RANDBETWEEN(7,11))

نصائح أخرى

Try,

=choose(randbetween(1,10),1,2,3,4,5,7,8,9,10,11)

As you can see 6 is not included in the list of random numbers.

In my opinion just use simple code:

 1. step1: 
 2. a = WorksheetFunction.RandBetween(1, 11) 
 3. If a = 6 Then GoTo step1

After that You will never receive 6 as result

You can use RANDBETWEEN(1,11) and add 1 to the result if the result is 6 or greater.

Disclaimer: I don't know about the actual syntax for that since I haven't worked with excel for quite some time...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top