+ Reply to Thread
Results 1 to 4 of 4

Randomly assign a value to rows

  1. #1
    Registered User
    Join Date
    04-08-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Randomly assign a value to rows

    I am not sure if this is possible in Excel but here goes.

    I have a worksheet that shows results of a golf tournament with in:
    column A the finishing position
    column B the name of the player
    column C their score
    The data has been sorted so that the results have the winner in the top row and last position in row "n" (where n is the number of players).

    I want to be able to randomly assign a team name to each player that finishes in positions 7 to "n" (no player can win more than one prize and we have prizes for the first six places) storing it in column D. The team name will be made up of a letter and a number, eg A1, A2, B1, B2 etc. This is so that we can have a blind pairs competition. I will then use the VLOOKUP function to find the teams and work out the blind pairs winners.

    Obviously the team name assigned must be unique to one player.

    I cannot assign the team names before the competition starts as those that finish in places 1 to 6 are not eligable for a blind pairs prize

    Has anyone any ideas on how I can achieve this?

  2. #2
    Registered User
    Join Date
    06-08-2011
    Location
    Orlando, Florida
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Help needed to randomly assign a value to rows

    Excel 2010 has the RAND and RANDBETWEEN functions. You, however, have Excel 2003 and I don't know if those functions are in 2003. If not, I suggest you use a number like pi, pick some place after the decimal to start and let the computer help. Since you are assigning just two players to a team, I think you could just have the computer print out pi to a sufficient number of decimal places and then use it manually. Depending on how many players need to be on a blind pairs team, you choose the way you use the digits in pi. If you only have 20 players in this category, then individual digits would work. You would just have to flex a bit.

    pi = 3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944

    Player 7 = 3
    Player 8 = 1
    Player 9 = 4
    Player 10 = 1
    Player 11 = 5
    Player 12 = 9
    Player 13 = 2
    Player 14 = 6 - Only one six
    Player 15 = 5
    Player 16 = 3
    Player 17 = 5 - Extra 5 Pair with the only six
    Player 18 = 8
    Player 19 = 9
    Player 20 = 7 - Only one seven
    Player 21 = 9 - Extra nine - pair with the only seven
    Player 22 = 3
    Player 23 = 2
    Player 24 = 3
    Player 25 = 8
    Player 26 = 4

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Randomly assign a value to rows

    rand() and randbetween() both exist in excel 2003
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Registered User
    Join Date
    04-08-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Randomly assign a value to rows

    Sorry, but I am a real novice with excel and as such I do not see how the RAND or RANDBETWEEN functions will do what I want.

    The problems I have with these fuctions are:
    1. how do I prevent duplicates?
    2. how do I convert the number to the team name or A1 etc?

    In an attempt to solve the second item above I added a new column and have the following formula on each row:

    =IF(COUNTIF(Results!$D$5:$D$10,C10)>0,"",'Course Data'!L(RANDBETWEEN(1,52)))

    This works fine if the player is in the first 6 places as the IF is true and therefore the team name is left blank. However, if the IF is false, then what I have put does not work.as I have no idea how to provide a random row number to the reference (Column L on the Course Data sheet contains a list of team names).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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