+ Reply to Thread
Results 1 to 8 of 8

Averaging a random sample from a data set

  1. #1
    Registered User
    Join Date
    02-10-2016
    Location
    Gurgaon
    MS-Off Ver
    2007
    Posts
    4

    Question Averaging a random sample from a data set

    Hi,

    I need to take average of 4/8 unique random values out of a sample of 16 values, there are a no. of 4*4 grids. what can be the easiest way to get the random sample average other than assigning each value a random value from 1-16 and taking any 4.
    I have attached a the data sample for reference. Random sample.xlsx

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Averaging a random sample from a data set

    Hi.

    I'd first go to Name Manager (Formulas tab) and define:

    Name: Permutations
    Refers to: ={1234,1243,1324,1342,1423,1432,2134,2143,2314,2341,2413,2431,3124,3142,3214,3241,3412,3421,4123,4132,4213,4231,4312,4321}

    Then you can use:

    =AVERAGE(INDEX(B2:E5,N(IF(1,0+MID(INDEX(Permutations,,RANDBETWEEN(1,16)),{1;2;3;4},1))),N(IF(1,0+MID(INDEX(Permutations,,RANDBETWEEN(1,16)),{1;2;3;4},1)))))

    At the cost of some additional resource, this can be made more flexible and less static such that it will work for ranges of any dimension, not just those which are 4x4. However, since you make no mention that this is a requirement, it makes sense to use a tailored, more efficient set-up.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    02-10-2016
    Location
    Gurgaon
    MS-Off Ver
    2007
    Posts
    4

    Re: Averaging a random sample from a data set

    Thanks for the suggestion ,

    Can you also tell me how this formula can be made flexible incase i wish to change the grid size (4*8/8*4 or 4*2) but still require only 4 values to calculate average.

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Averaging a random sample from a data set

    Is there an upper bound on the largest grid size you'll ever wish to consider?

    Regards

  5. #5
    Registered User
    Join Date
    02-10-2016
    Location
    Gurgaon
    MS-Off Ver
    2007
    Posts
    4

    Re: Averaging a random sample from a data set

    16*8 would be the largest grid size .

    Thanks,

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Averaging a random sample from a data set

    Thanks. Sorry, forgot to ask - and the smallest? 4x2?

    Regards

  7. #7
    Registered User
    Join Date
    02-10-2016
    Location
    Gurgaon
    MS-Off Ver
    2007
    Posts
    4
    Quote Originally Posted by XOR LX View Post
    Thanks. Sorry, forgot to ask - and the smallest? 4x2?

    Regards
    Yes 4*2 is the smallest.

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Averaging a random sample from a data set

    Beyond a 6x6 grid, an in-formula solution becomes problematic (and very resource-heavy).

    I would suggest using 4 additional cells within the worksheet somewhere, if that's something you would consider.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 02-17-2014, 06:34 AM
  2. Random Sample with Parameters
    By alexandrite in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2011, 01:29 PM
  3. Random Sample
    By Saarang84 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-18-2009, 07:31 PM
  4. Random sample
    By RIROCKHOUND in forum Excel General
    Replies: 1
    Last Post: 11-09-2006, 07:17 PM
  5. random sample
    By skimpw in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-14-2006, 08:15 PM
  6. Random Sample Without Duplication
    By beccadawn0622 in forum Excel General
    Replies: 3
    Last Post: 01-25-2006, 10:15 AM
  7. [SOLVED] Is it possible to do a random sample of non-numeric data in Excel?
    By Terri G in forum Excel General
    Replies: 4
    Last Post: 12-15-2005, 01:50 PM
  8. [SOLVED] URGENT- Random Sample per range of data
    By Another Jennifer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2005, 10:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1