+ Reply to Thread
Results 1 to 10 of 10

Generate Random Number Wihout Repeat In One Cell

  1. #1
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Generate Random Number Wihout Repeat In One Cell

    Hi,

    I am creating a sheet in excel for my company lucky draw. I have 500 participants and I need to create a formula in a single cell that would randomly generate numbers between 001 to 500 without repetitions in one single cell when the guest of honor hits F9. I tried RAND and then RANDBETWEEN but it does generate duplicates.

    I have looked through the other post but most are VBA and does not generate in one single cell.

    Appreciate all the help I could get.

    I have a cross post here:

    http://www.mrexcel.com/forum/excel-q...-one-cell.html

  2. #2
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Re: Generate Random Number Wihout Repeat In One Cell

    Hi,

    Just to add that the numbers needs to be generated in one cell and one by one for 50 numbers as we have 50 lucky draws to be given away.

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

    Re: Generate Random Number Wihout Repeat In One Cell

    This can not be done using a single formula in a single cell.

    Why do you want all the numbers in a single cell?

    With the RAND and RANDBETWEEN functions, each time you press function key F9 they will generate new numbers.
    Last edited by Tony Valko; 02-20-2014 at 10:24 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Contributor
    Join Date
    07-24-2009
    Location
    Valrico, FL USA
    MS-Off Ver
    Excel 2016
    Posts
    358

    Re: Generate Random Number Wihout Repeat In One Cell

    The attached workbook will display 50 random non repeating numbers from 1 to 500 in 1 cell.
    Columns A:D can be hidden.
    Attached Files Attached Files

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

    Re: Generate Random Number Wihout Repeat In One Cell

    Now I have to edit my previous reply!

  6. #6
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Re: Generate Random Number Wihout Repeat In One Cell

    Hi,

    Thank you for your time and patience. My apologies as I might not have been clear in my post. We will set up the excel screen and as the VIP hits F9, one by one random numbers from 001-500 will populate in a single cell ( not all 50 random numbers at once) and the lucky draw prizes will be given for 50 people. Based on the spreadsheet, can I use cell C2 for this purpose?

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

    Re: Generate Random Number Wihout Repeat In One Cell

    You'll need a VBA procedure to do it the way you want.

    I'm not much of a programmer so someone else will need to help you.

    You should post this question in the Excel Programming / VBA / Macros forum. Contact any moderator or administrator and ask them to move this thread into that forum.

    Good luck!

  8. #8
    Forum Contributor
    Join Date
    08-19-2006
    MS-Off Ver
    Excel 365
    Posts
    229

    Re: Generate Random Number Wihout Repeat In One Cell

    Hi,

    Ok , I will do that.

    Just to add: Is there a way we can assign the macro to a button and when we click the macro once, the numbers run many time and then come to a stop for the winning number just like a slot machine? We can then do this for 50 times for all 50 winners.

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

    Re: Generate Random Number Wihout Repeat In One Cell

    If you had Excel 2013, it already does that!

    It sounds feasible but I don't know for sure as I'm not much of a programmer.

  10. #10
    Registered User
    Join Date
    06-02-2015
    Location
    Bangkok
    MS-Off Ver
    2013
    Posts
    1

    Re: Generate Random Number Wihout Repeat In One Cell

    Thanks all, I have to use lucky draw random every month, this may save my time a lot.

+ 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: 8
    Last Post: 11-18-2013, 04:24 PM
  2. How to generate a random sample and repeat it 1000 times
    By random_Monkey in forum Excel General
    Replies: 4
    Last Post: 08-15-2013, 10:15 AM
  3. Replies: 5
    Last Post: 06-21-2013, 10:40 AM
  4. Replies: 6
    Last Post: 12-06-2012, 08:14 PM
  5. generate a random number and use if function to generate new data
    By Dogdoc1142 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-25-2006, 10:50 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