+ Reply to Thread
Results 1 to 6 of 6

Formula to randomly assign one of four values to a cell

  1. #1
    Registered User
    Join Date
    03-22-2016
    Location
    Kingstree, South Carolina
    MS-Off Ver
    2010
    Posts
    2

    Formula to randomly assign one of four values to a cell

    I need help in creating a formula that will randomly assign one of four specific values to a cell. The four values are Box, Tank, Gondola, and Flat. Thank you in advance for your help.

    Harry Adkins

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to randomly assign one of four values to a cell

    Try
    =CHOOSE(RANDBETWEEN(1,4),"Box","Tank","Gondola","Flat")

  3. #3
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Formula to randomly assign one of four values to a cell

    In, say, A1:A4 put 1, 2,3 and 4 respectively. In B1:B4 put Box, Tank, Gonola and Flat respectively.

    Formula would then be: =INDEX($B$1:$B$4,MATCH(RANDBETWEEN(1,4),$A$1:$A$4,0))

    Every time a recalculation is done the result of the formula will be updated.

    (Or use Jonmo1's simpler formula)
    Please add reputation by clicking on the * if I have helped.
    Please mark the thread SOLVED if your issue has been resolved.
    Thanks, Glenn.

  4. #4
    Registered User
    Join Date
    03-22-2016
    Location
    Kingstree, South Carolina
    MS-Off Ver
    2010
    Posts
    2

    Re: Formula to randomly assign one of four values to a cell

    Thanks gentlemen. I really appreciate your help.

    Harry

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Formula to randomly assign one of four values to a cell

    You're welcome.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula to randomly assign one of four values to a cell

    Quote Originally Posted by gak67 View Post
    =INDEX($B$1:$B$4,MATCH(RANDBETWEEN(1,4),$A$1:$A$4,0))
    No need for the MATCH function:

    =INDEX($B$1:$B$4,RANDBETWEEN(1,4))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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: 2
    Last Post: 11-20-2015, 03:10 PM
  2. Assign players to teams randomly
    By buhaj47 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2015, 05:26 PM
  3. Randomly assign to groups, without duplicates
    By rw2 in forum Excel General
    Replies: 5
    Last Post: 05-08-2015, 08:31 AM
  4. [SOLVED] Randomly assign codes to cells
    By Gemsie in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-29-2013, 12:28 PM
  5. Randomly assign a value to rows
    By covegolfer in forum Excel General
    Replies: 3
    Last Post: 06-13-2011, 12:29 PM
  6. Randomly (and evenly) assign colors to cells
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2010, 05:22 PM
  7. How do I randomly assign values in a grid?
    By Excel question in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2005, 08:05 PM

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