+ Reply to Thread
Results 1 to 4 of 4

Defaulting a random number

  1. #1
    Registered User
    Join Date
    07-30-2006
    Posts
    2

    Defaulting a random number

    Hi

    I am developing an AFL football score calculator using the RAND function.

    Is there a function that can default a cell to "0" after a random number has been created.

    I use F9 to do the random number, is there a formula or funtion that I can use to default that cell?

    Any help is appreciated, thanks in advance.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Quote Originally Posted by Pozman
    Hi

    I am developing an AFL football score calculator using the RAND function.

    Is there a function that can default a cell to "0" after a random number has been created.

    I use F9 to do the random number, is there a formula or funtion that I can use to default that cell?

    Any help is appreciated, thanks in advance.
    Hi Pozman,

    I assume you want the "0" in another cell?

    Try something like this in cell B1

    =IF(A1>0,0,"") if your random number is in A1, B1 will be 0, otherwise nothing

    Alter cell ref's to suit

    Is this what you are looking for?

    oldchippy

  3. #3
    Registered User
    Join Date
    07-30-2006
    Posts
    2

    Hmmm not realy

    Hi Old Chippy

    Sorry for the late reply and thanks for taking the time to help me out.

    What Im looking to create is a random sports calculator.

    Say for example you wanted to make one for soccer. You would start by putting two teams in then hitting F9 to produce a random score using the RAND function.

    Then if you wante to play again you would have another key/funtion that would reset the scores to 0 - 0 in that same cell.

    Then the process is repeated. It is a situation that is probably best suited for something like visual basic, but I dont have it or know how to use it. So I'd really like to be able to create it in exel.

    If you can help anymore thats great and thanks heaps.

    Cheers

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Thumbs up

    OK

    If I understand correctly, try something like this,

    Record a marco – Tools > Macro > Record new macro

    Macro1 > Select store in this workbook, then OK

    Click cell A1, input =RAND()
    Click cell B1, input =RAND()

    Stop marco recording

    Now record macro2

    Record a marco – Tools > Macro > Record new macro

    Macro2 > Select store in this workbook, then OK

    Click cell A1, input 0
    Click cell B1, input 0

    Stop marco recording

    Now - View > Toolbars > Forms

    Click on the "button" icon and draw one on your spreadsheet (Button 1), the Assign macro box opens – select Macro1 > OK

    Now do the same for Macro2

    Click button 1 for random numbers
    Click button 2 for 0’s

    oldchippy

+ 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