ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Defaulting a random number (https://www.excelbanter.com/excel-worksheet-functions/102120-defaulting-random-number.html)

Pozman

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.


--
Pozman
------------------------------------------------------------------------
Pozman's Profile: http://www.excelforum.com/member.php...o&userid=36928
View this thread: http://www.excelforum.com/showthread...hreadid=566384


oldchippy

Defaulting a random number
 

Pozman Wrote:
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(A10,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 :confused:


--
oldchippy
------------------------------------------------------------------------
oldchippy's Profile: http://www.excelforum.com/member.php...o&userid=19907
View this thread: http://www.excelforum.com/showthread...hreadid=566384


Pozman

Defaulting a random number
 

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


--
Pozman
------------------------------------------------------------------------
Pozman's Profile: http://www.excelforum.com/member.php...o&userid=36928
View this thread: http://www.excelforum.com/showthread...hreadid=566384


oldchippy

Defaulting a random number
 

OK :confused:

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 :cool:


--
oldchippy
------------------------------------------------------------------------
oldchippy's Profile: http://www.excelforum.com/member.php...o&userid=19907
View this thread: http://www.excelforum.com/showthread...hreadid=566384



All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com