Random Number Within Specific Range (Function)

dmrcs

New Member
Joined
Dec 5, 2021
Messages
14
Office Version
  1. 365
Hello there,

Seen a lot of literature on this but not something as specific (via organic search).

Let's say I have a list of numbers in one column. What function (no macro) would enable me to randomise the appearance of a number not in the first column but within a specific range (from 1 to 100).

Screenshot 2021-12-05 at 14.47.13.png


In other words, a function that would show a number in cell C2 not currently featured on list in column B, but that number has to be between 1 to 100.

I've seen functions that can show a random number currently featured, but no function that shows a number not currently there.

Could it also be made more complex? As in: "I want the random number to have at least a 6 in it" so you get 16, 26, 36...

Many thanks in advance!
 
Hi & welcome to MrExcel.
How about
Excel Formula:
=LET(s,SEQUENCE(100),f,FILTER(s,(ISNA(MATCH(s,B2:B7,0)))*(ISNUMBER(FIND(6,s)))),INDEX(SORTBY(f,RANDARRAY(ROWS(f))),1))
@Fluff
Sorry to disturb, any chance this could be updated to avoid giving numbers with 6s in it?
The other formula just seems to fail when there's more than 100 rows (I've tried fiddling with it, there are over 1000 on the file, but it returns a REF error).
Many thanks!
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
Excel Formula:
=LET(s,SEQUENCE(100),f,FILTER(s,ISNA(MATCH(s,B2:B7,0))),INDEX(SORTBY(f,RANDARRAY(ROWS(f))),1))
But if you have over 1000 values in col B, how do you expect to return a number between 1 & 100?
 
Upvote 0
How about
Excel Formula:
=LET(s,SEQUENCE(100),f,FILTER(s,ISNA(MATCH(s,B2:B7,0))),INDEX(SORTBY(f,RANDARRAY(ROWS(f))),1))
But if you have over 1000 values in col B, how do you expect to return a number between 1 & 100?
True, I need it to return a number between 1 and 1500
 
Upvote 0

Forum statistics

Threads
1,212,934
Messages
6,110,762
Members
448,295
Latest member
Uzair Tahir Khan

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