Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
gipsassignment
 
Posts: n/a
Default how to write the formula using INDEX?

hi, i gotta a problem when doing an assignment of writing the formula:

Given that Paper breaks Rock, Rock breaks Scissors, Scissors breaks Paper

I need to let the computer randomly generates Paper/Rock/Scissors(well this
formula i can do), then i input one of the three and then the computer will
automatically come out the result. Thanks!

  #2   Report Post  
Bryan Hessey
 
Posts: n/a
Default


Hi,

To generate a random selection, put =rand() in A1 A2 and A3
put "scissors" in B1, "paper" in B2 and "rock" in B3,
then put
=VLOOKUP(SMALL(A1:A3,1),A1:B3,2,FALSE)
in C1
This will generate a new guess each calculation, including your entry
(providing that auto-calculate in on)

setup a table for lookup (say, A10 to B19) with (ignore the dots, they
are for spacing purposes only)

scissorsscissors ..... equal
scissorspaper ........ scissors cuts paper, computer wins
scissorsrock ........... rock blunts scissors
paperscissors ........ scissors cuts paper
paperpaper ............ equal
paperrock .............. paper wraps rock, computer wins
rockscissors ........... rock blunts scissors, computer wins
rockpaper .............. paper wraps rock
rockrock ................. equal

and, in cell E1 put =VLOOKUP(C1&D1,A10:B19,2,FALSE)

enter your guess in D1

This should provide you the answer.



gipsassignment Wrote:
hi, i gotta a problem when doing an assignment of writing the formula:

Given that Paper breaks Rock, Rock breaks Scissors, Scissors breaks
Paper

I need to let the computer randomly generates Paper/Rock/Scissors(well
this
formula i can do), then i input one of the three and then the computer
will
automatically come out the result. Thanks!



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=472397

  #3   Report Post  
Bryan Hessey
 
Posts: n/a
Default


Of course, I could read the question correctly, and use INDEX (it's an
assignment, nothing to do with normalness)

set your table as

B10=scissors C10=paper D10=rock
A11=scissors B11=equal C11=scissors cuts paper, computer wins D11=rock
blunts scissors
A12=paper B12=scissors cuts paper C12=equal D12=paper wraps rock,
computer wins
A13=rock B13=rock blunts scissors, computer wins C13=paper wraps rock
D13=equal

and your formula

=INDEX(B11:D13,MATCH(C1,A10:A12,0),MATCH(D1,B10:D1 0,0))

(note the final match is MATCH(D1,B10:D10,0)) but keeps reflecting
incorrectly)

where C1 is the computers guess, and D1 is yours.


Bryan Hessey Wrote:
Hi,

To generate a random selection, put =rand() in A1 A2 and A3
put "scissors" in B1, "paper" in B2 and "rock" in B3,
then put
=VLOOKUP(SMALL(A1:A3,1),A1:B3,2,FALSE)
in C1
This will generate a new guess each calculation, including your entry
(providing that auto-calculate in on)

setup a table for lookup (say, A10 to B19) with (ignore the dots, they
are for spacing purposes only)

scissorsscissors ..... equal
scissorspaper ........ scissors cuts paper, computer wins
scissorsrock ........... rock blunts scissors
paperscissors ........ scissors cuts paper
paperpaper ............ equal
paperrock .............. paper wraps rock, computer wins
rockscissors ........... rock blunts scissors, computer wins
rockpaper .............. paper wraps rock
rockrock ................. equal

and, in cell E1 put =VLOOKUP(C1&D1,A10:B19,2,FALSE)

enter your guess in D1

This should provide you the answer.



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=472397

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
write formula from one worksheet and return to another ws cindyd Excel Discussion (Misc queries) 1 September 23rd 05 11:51 PM
Can you help me write this formula? blazon Excel Discussion (Misc queries) 6 September 20th 05 07:07 PM
Help needed with Adapting complex INDEX formula sonar Excel Worksheet Functions 2 August 27th 05 01:40 PM
How do I write formula to compare two values and pull the resulta. Renee Excel Worksheet Functions 1 February 11th 05 01:31 AM
how do i write a formula and keep in in formula form, so it DOESN. norcalchick2207 Excel Discussion (Misc queries) 2 February 4th 05 08:38 PM


All times are GMT +1. The time now is 03:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"