+ Reply to Thread
Results 1 to 7 of 7

Generating a random set of numbers within Excel

  1. #1
    Registered User
    Join Date
    03-26-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    3

    Generating a random set of numbers within Excel

    Hi Everyone,

    I am pretty new to the forum and my knowledge is okay (30-40%) on excel, actually 20% knowledge...

    I have a configurator that I use to generate an equipment Bill of Material, I want to create a Macro that when I open the configurator (Excel) it populates a random set of numbers into a cell. This number will be used as an Order Number of Reference number to the quotation/system build. This could be a 6 digit number sting, it needs to be different each time it opens. I have had no luck to date and was hoping someone with some experience could assist.

    Thanks - look foward to the help.. Rhys

  2. #2
    Forum Contributor
    Join Date
    03-12-2013
    Location
    Chicago, USA
    MS-Off Ver
    Excel 2007
    Posts
    230

    Re: Generating a random set of numbers within Excel

    You could use the =rand() function. That will generate a random number between 0 and 1.

  3. #3
    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
    52,933

    Re: Generating a random set of numbers within Excel

    Hi and welcome to the forum

    The =rand() will work for you, but it will change/update every time you do anything to the file (enter data into a cell, enter a formula, edit a cell etc). So if you only want it to change the 1 time (when you open the file) you will need to set calculation to manual.

    However, this will have the disadvantage that NO other formulas will calc either, unless you press F9 - which will change your random number again
    (just wanted to add some additional info for you)
    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

  4. #4
    Registered User
    Join Date
    03-26-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Generating a random set of numbers within Excel

    Thanks for the reply - I have used =RANDBETWEEN(0,5000) but the issue is as you mentioned it changes everytime I add an input into another cell.

    How do I have it so its manual? All I want is a unique number when the excel is opened.

    Cheers

  5. #5
    Registered User
    Join Date
    03-26-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Generating a random set of numbers within Excel

    If anyone out there can help it would be greatly appreciated.

  6. #6
    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
    52,933

    Re: Generating a random set of numbers within Excel

    If you are using 2003, as your profile says...

    select tools/options/calculation/manual

  7. #7
    Registered User
    Join Date
    03-24-2013
    Location
    Earth
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    81

    Re: Generating a random set of numbers within Excel

    I SUGGEST you following solution

    1> use a formula = large(sheet_quotation_ordernumber ,1 )+1 , when you actual fill data in quotation sheet )
    2> 6 digit is not good for random , or your set a button to maintain auto increase ordernumber ,maybe more better , text( now(), "yyyymmdd_HHMMSS" )

+ 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