OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Fun Complex Code Question

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
zeratulcraft
Newbie
Newbie


Joined: 05 Mar 2008
Posts: 2

PostPosted: Wed Mar 05, 2008 4:20 am    Post subject: Fun Complex Code Question Reply with quote

Hi

I have a random number function ( =RANDBETWEEN(1;55)) and 1;49. This is working fine, but I want a second piece of code to look at the number, and based on the result, out put the appropriate piece of information.

Example;

Value is 12, Code sees 12, goes across to column 12 and sees "Apple" so it prints Apple in the cell. Or the value is 35, Code sees 35, goes across to column 35 and sees "Banana" so it prints that in the cell instead.

I have no clue how to code such complexities, my code so far can just tell me whether the value is 1, print the appropriate cell, or if it's not 1, and print a second cell's information.

Is there a way to embed multiple layers of IF statements? Any help would be greatly appreciated.

Thank you.
Z
Back to top
View user's profile Send private message MSN Messenger
keme
Moderator
Moderator


Joined: 30 Aug 2004
Posts: 2910
Location: Egersund, Norway

PostPosted: Wed Mar 05, 2008 4:45 am    Post subject: Reply with quote

Assuming the lookup list of words is in row 1, column C to AU, and your random number is in cell A1.

In cell B1, enter =INDEX(C1:AU1;1;A1)
Back to top
View user's profile Send private message
zeratulcraft
Newbie
Newbie


Joined: 05 Mar 2008
Posts: 2

PostPosted: Wed Mar 05, 2008 5:26 am    Post subject: Reply with quote

Great Very Happy That does it perfect, thanks so much!
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group