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

Discuss the spreadsheet application

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

Postby Brevardo » Sat Jul 20, 2019 1:19 pm

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
Brevardo
 
Posts: 13
Joined: Sat Jul 20, 2019 12:58 pm

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

Postby Zizi64 » Mon Jul 22, 2019 7:53 am

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   Expand viewCollapse view
=IF(G25=24;"Double";"")

Code: Select all   Expand viewCollapse view
=IF(G25=7;"Ground out";"")

And you can use combined (nested) the IF statements too.
Code: Select all   Expand viewCollapse view
=IF(G25=24;"Double";IF(G25=7;"Ground out";""))
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
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.
User avatar
Zizi64
Volunteer
 
Posts: 8137
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby Brevardo » Mon Jul 22, 2019 1:21 pm

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
Brevardo
 
Posts: 13
Joined: Sat Jul 20, 2019 12:58 pm

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

Postby Zizi64 » Mon Jul 22, 2019 2:05 pm

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   Expand viewCollapse view
=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; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
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.
User avatar
Zizi64
Volunteer
 
Posts: 8137
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby Brevardo » Mon Jul 22, 2019 2:45 pm

Okay. That makes sense. Let me go ahead and try that and Ill keep you posted. Thanks again
Open Office 3.1
Brevardo
 
Posts: 13
Joined: Sat Jul 20, 2019 12:58 pm

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

Postby RusselB » Mon Jul 22, 2019 3:43 pm

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.6 and LibreOffice 6.0.6.2 on Windows 7 Pro & Ultimate
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
RusselB
Moderator
 
Posts: 5282
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

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

Postby MrProgrammer » Mon Jul 22, 2019 4:06 pm

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.5 Build 9789 on MacOS 10.11.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3778
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA


Return to Calc

Who is online

Users browsing this forum: robleyd and 18 guests