# Formula calculation

Jun 06, 2022

By
Tech RockED

Hi Everyone,

I need to perform a calculation in the storyline, which has the formula in it.

-----------------------------------------------------

**User Input (a,b,c) and I have created the variables (E, F, G, H)**

To Find:

**E=(a/(b/c))*2**

and have to display

**F=E*2**

**G=E*4**

**H=E*6**

**----------------------------------------------------**

Is this something that can be done in Storyline or does it require javascript?

**Any help is much appreciated!**

Thanks

Sudhakar

## 1 Reply

You could do this if you break it up into a number of triggers. There may be a more slick way of doing this but just using storyline triggers this is probably the easiest way.

divide b by c

divide a by b (which is now different to what was entered)

multiply a by 2

Set E to value of a

That's the first bit. Then you just need to calculate the others. You'll see that after each answer is set I multiply E again so that the next set of calculations can happen.

Multiply E by 2

Set F to that answer

Divide E by 2

Multiply E by 4

Set G to that answer

Divide E by 4

Multiply E by 6

Set H to that answer

Divide E by 6

I've attached a storyline file which should help make sense of this!

calculation_example.story