Consulting

Results 1 to 3 of 3

Thread: Drawing sample in Excel

  1. #1

    Drawing sample in Excel

    Hi again, I am wondering if there is any formula to draw a random sample of fixed size in excel.

    Let say, In the 1st column I have a list of City-names of length 100. Now I want to draw a Random-sample of Cities of size 10 out of 100. All 100 cities have equal probability to get selected in my sample of size 10. What is the way for doing this.

    Really appreciate for your pointer.

    Thanks,

  2. #2
    VBAX Mentor
    Joined
    Feb 2015
    Posts
    395
    Location
    Pinter is that unless doing this regularly, no need for VBA.
    Excel has a random number function. I would just use that as follows:

    1 In cell A1 type "City Names"
    2 In cells A2 to A101 put in your 100 City Names
    3 In cell B2 type "Random"
    4 In cell B2 type the formula =RAND()
    5 Copy the formula from B2 to cells B3 to B101
    6 Select column B and overwrite column B by pasting values
    7 Decide now whether to take the first 10 city names, or the last 10, or 10 city names starting at a given row - choose anything - it does not matter!
    8 Sort the data in columns A and B - sort by RANDOM (=columnB) telling Excel that you have headers
    9 Based on what you chose to do in 7 above, you have your random sample

  3. #3
    VBAX Mentor
    Joined
    Feb 2015
    Posts
    395
    Location
    Oops in previous post please read Pinter as Pointer!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •