Is there a way to reference the result of Randbetween() with If()?

asked 2018-09-25 17:25:25 +0100

Miletech gravatar image

updated 2018-09-25 17:55:03 +0100

In this example Column A gives us a written number One, Two or Three. Column B gives a descriptor and Column C gives us an animal. If the answer results in Three Fat Cat, I would like to know if it's possible to create an if statement that would recognize the result of

=CONCAT(INDEX(A1:A3, RANDBETWEEN(1,3))," ",INDEX(B1:B3, RANDBETWEEN(1,3))," ",INDEX(C1:C3, RANDBETWEEN(1,3)))

So that if Two or Three were written, it would then Concatenate an additional "s" to make the outcome more accurate, but to the specificity that I would add the "s" to cat and rhino, but not to moose.

C:\fakepath\Concept.ods

edit retag flag offensive close merge delete

Comments

I was able to get it somewhat though it's quite a bit more formula than I was looking to do. Is there perhaps a more direct way?

Miletech gravatar imageMiletech ( 2018-09-25 18:43:32 +0100 )edit

Here's how I did it:

A6 is =(INDEX(A1:A3, RANDBETWEEN(1,3))) so it returns One, Two or Three

B6 is =(INDEX(B1:B3, RANDBETWEEN(1,3))) so it returns fat, small or tall

C6 is =(INDEX(C1:C3, RANDBETWEEN(1,3))) so it returns cat, rhino or moose

D6 is =IF(AND(OR(A6="Three",A6="Two"),OR(C6="cat",C6="rhino")),"s.",".") so it adds s. to cat and rhino if two or three are randomly selected and just a . if there isn't a plural.

D5 is =CONCAT(A6," ",B6," ",C6,D6) so it compiles and adds spaces

Miletech gravatar imageMiletech ( 2018-09-25 18:45:03 +0100 )edit