[Solved]Trying to move the results of a RAND function

Discuss the spreadsheet application
Post Reply
Brevardo
Posts: 15
Joined: Sat Jul 20, 2019 12:58 pm

[Solved]Trying to move the results of a RAND function

Post by Brevardo »

I have a formula for creating a random number in a cell. Now i would like to execute the formula each time so when it calculates the random number i can have it show up in a stand alone cell. The reason i want to do this is because each time i calculate it or execute the command i will see a different number between 1 and 30. I then want to be able to create a new command such as IF that will say, "if g 25 = 24, "Double" or "if g25 = 7, "Ground out" Any help is greatly appreciated. Thanks
Last edited by Brevardo on Tue Jul 23, 2019 3:18 am, edited 1 time in total.
Open Office 3.1
User avatar
Zizi64
Volunteer
Posts: 11360
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Trying to move the results of a RAND function from the c

Post by Zizi64 »

Now i would like to execute the formula each time so when it calculates the random number i can have it show up in a stand alone cell.
You can not COPY a value by a FORMULA. A formula will REFERENCE the value.
Copy it manually or write a macro for this task.

I then want to be able to create a new command such as IF that will say, "if g 25 = 24, "Double" or "if g25 = 7, "Ground out"

Code: Select all

=IF(G25=24;"Double";"")

Code: Select all

=IF(G25=7;"Ground out";"")
And you can use combined (nested) the IF statements too.

Code: Select all

=IF(G25=24;"Double";IF(G25=7;"Ground out";""))
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Brevardo
Posts: 15
Joined: Sat Jul 20, 2019 12:58 pm

Re: Trying to move the results of a RAND function from the c

Post by Brevardo »

Okay. This is good info. If i do the nested example you provided, can i have 4 or 5 "If" commands? The only thing that confused me was the parentheses. How many would I need to have in the formula if say I use 5 "If" commands? Thanks
Open Office 3.1
User avatar
Zizi64
Volunteer
Posts: 11360
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Trying to move the results of a RAND function from the c

Post by Zizi64 »

If i do the nested example you provided, can i have 4 or 5 "If" commands?
Yes you can. See the Help.

Code: Select all

=IF(The Condition;Output when it is True;Output when it is False)
You can insert a new IF() into the output places of a formula.

But it is better to use a helper table and the function VLOOKUP() instead of the nested IF() - when you want to use more than 3-4 conditions for same input parameter.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Brevardo
Posts: 15
Joined: Sat Jul 20, 2019 12:58 pm

Re: Trying to move the results of a RAND function from the c

Post by Brevardo »

Okay. That makes sense. Let me go ahead and try that and Ill keep you posted. Thanks again
Open Office 3.1
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Trying to move the results of a RAND function from the c

Post by RusselB »

If you have a lot of conditions that you want to have specific messages for, then using a table and the VLOOKUP function, as I now see Tibor already suggested.
The table option would also allow quick changes, additions and deletions if the messages and/or number of messages changed.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
MrProgrammer
Moderator
Posts: 4907
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Trying to move the results of a RAND function from the c

Post by MrProgrammer »

Brevardo wrote:I then want to be able to create a new command such as IF that will say, "if g 25 = 24, "Double" or "if g25 = 7, "Ground out"
[Tutorial] VLOOKUP questions and answers

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Brevardo wrote:Any help is greatly appreciated.
[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply