# Can I use a variable in a formula question to compute another variable?

Question asked by Deborah Gaydos on Jun 10, 2016
Latest reply on Jun 11, 2016 by Deborah Gaydos

I'm working on a test bank for a stats class, and in writing some probability questions, here is what I found myself wanting to do:

I have a variable that represents a probability as a percent, which I am allowing to be, say, between 50 and 70. We'll call this P1.

I want a second probability to be related to the first one, and to be at least 20% lower than it, but with a random factor too. So what I really want to do is set up a computational-only variable, call it x, that can run between -5 and 5. Then I can compute my second probability, which I'll call P2, using the formula:  P2=P1-25+x  and use [P2]% in the problem text.

This achieves what I want, as P2 will run between 20% and 50%, but always at least 20% lower than P1. But I see no way to define the variable x at all, since I never use it in the problem text; and if I put [P2]% in the problem text, it only allows me to set a range for P2 numerically, not to define it in terms of other variables.

So I am assuming that it isn't possible to do what I want here... unless I'm missing something? Maybe this will be addressed by the new quiz engine? It seems like such a relatively simple/obvious thing, if you are using formulas in problems, this isn't a big leap. It would be simple to generate in Excel. I would really like to be able to do it in Canvas. For now, I'm just going to let P1 run from 50-70 and let P2 run from 20-45, but that isn't nearly as snazzy as how I would like to set it up.