• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need Help With Random Population

ham123

Member
Hi everyone, I need help with making a Random Population VBA.

For now, I have made an example based on a formula:
=INDEX(Lists!A2:A612, RANDBETWEEN(2, 612))

What I am trying to do is to randomly populate data from the 'Lists" Sheets based on the range specified. I am trying to populate this data to a certain range: ActiveSheets("F5:F500")

Any help is much appreciated! :)
 
Ham123

Firstly, Welcome to the Chandoo.org Forums

Do you want to choose 495 of the 610 items from the first list ?
I'll assume items can';t repeat

I would add a helper column to the original data and simply have the formula =rand() in that column

Then in the destination use a formula to retrieve the n'th largest item from the list using the helper column as a lookup column
=index(Your list, match(large(helper column, rows(Data Range Start:Data Range Current cell)), helper column, 0))

If you attach a sample file we can show you how
 
@Hui Hi there, thank you for your reply! :)

Items can be repeated and I want to include all 610 items from the first list.

I have attached a sample file for your reference
 

Attachments

  • to-do-list (Repaired).xlsm
    91 KB · Views: 1
Last edited:
Back
Top