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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
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,224,735
Messages
6,180,635
Members
452,991
Latest member
JM_000888

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