Shyretta Jenkins
asked on
Formula
I'm trying to create a formula that chooses a random number between 1 and max value derived from a VLOOKUP table, but it can't repeat the same number twice
Pretty easy in Excel to generate random numbers in a range, just use the =RANDBETWEEN(1,10) function for example, generating integers between 1 and 10. If you want to pull the max value from a cell or VLOOKUP just put that where the 10 is.
That being said, the desire not to repeat duplicates is going to be the tricky one and we may need more info. Left alone, the function will indeed repeat values, since each random generation is separate from the others, so it's certainly possible to randomly generate the same number multiple times. To avoid that the prior generated numbers will need to be saved, and then searched on each following attempt, and if the current generated random number was previously generated, then loop to try another randomly generated number. As mentioned by Ryan this would likely be easiest in a VBA macro function, but would need to fully understand your usage better.
~bp
That being said, the desire not to repeat duplicates is going to be the tricky one and we may need more info. Left alone, the function will indeed repeat values, since each random generation is separate from the others, so it's certainly possible to randomly generate the same number multiple times. To avoid that the prior generated numbers will need to be saved, and then searched on each following attempt, and if the current generated random number was previously generated, then loop to try another randomly generated number. As mentioned by Ryan this would likely be easiest in a VBA macro function, but would need to fully understand your usage better.
~bp
ASKER
Attached is a test file. However, the formula is what was given to me . I am not sure what the OFFSET function is actually doing.
Attachment?
~bp
~bp
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
can you provide a sample of your work so far here?