+ Reply to Thread
Results 1 to 7 of 7

Index and Rand Excel Function Help

  1. #1
    Registered User
    Join Date
    08-17-2016
    Location
    California
    MS-Off Ver
    2010
    Posts
    3

    Index and Rand Excel Function Help

    Hi,
    I need to select a random cell from A1:A49 out of an array of A1:A60. After a cell was chosen, I want to select 11 more cells below the chosen cell and calculate the average. For example,
    1. if A11 was selected randomly, It will also select 11 more cells below it so a total of A11:A22 to calculate the average.
    2. If A49 was chosen randomly , then A49:A60 will be used to calculate the average.

    Thank you for your help!
    Attached Files Attached Files
    Last edited by Officehelppl; 08-18-2016 at 01:23 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Index and Rand Excel Function Help

    You can put this formula in C2:

    =RANDBETWEEN(1,49)

    to get a random number between 1 and 49, and then you can use this formula (e.g. in C4):

    =AVERAGE(INDIRECT("A"&C2&":A"&C2+11))

    to get the average from that cell to the next 11.

    Hope this helps.

    Pete

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,179

    Re: Index and Rand Excel Function Help

    Or try this ...

    =AVERAGE(OFFSET($A$1,RANDBETWEEN(0,48),,11,1))

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Index and Rand Excel Function Help

    Hi, welcome to the forum

    Please upload your file to the forum. Not all members are able - or willing - to access file-hosting sites
    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    08-17-2016
    Location
    California
    MS-Off Ver
    2010
    Posts
    3

    Re: Index and Rand Excel Function Help

    Pete,
    Randbetween(1,49) would generate a random number between 1-49, but in this case, I want excel to choose a random cell that already has a value. I do not want a random number. Thanks!

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,426

    Re: Index and Rand Excel Function Help

    But that random number is then used in the other formulae to determine the average, which is what I thought you wanted. If the random number is, say, 17, then the other formula is effectively:

    =AVERAGE(A17:A28)

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    08-17-2016
    Location
    California
    MS-Off Ver
    2010
    Posts
    3

    Re: Index and Rand Excel Function Help

    Yeah we are on the right track; however, what I want is a random cell from A1:A49 not a random number from 1-49. But, thanks for your help! At least now I have some clues.
    Quote Originally Posted by Pete_UK View Post
    But that random number is then used in the other formulae to determine the average, which is what I thought you wanted. If the random number is, say, 17, then the other formula is effectively:

    =AVERAGE(A17:A28)

    Hope this helps.

    Pete

+ 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. Using INDEX/RAND to fill cells with no duplicate values
    By Tony Vargo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-02-2014, 05:17 AM
  2. [SOLVED] Index, Match & Countif ... Use with the "Rand" function
    By traceylreed in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-30-2012, 07:48 AM
  3. Using Index, Indirect and Rand functions.
    By bolger in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-05-2007, 06:09 PM
  4. RAND FUNCTION
    By theo499 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-11-2006, 12:15 AM
  5. [SOLVED] re: Rand function
    By Susan Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 PM
  6. [SOLVED] re: Rand function
    By Susan Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  7. [SOLVED] re: Rand function
    By Harlan Grove in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 02:05 PM
  8. re: Rand function
    By Susan Hayes in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

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