# Reusable formulas with variable

**URL:** <https://community.weweb.io/t/reusable-formulas-with-variable/12632>\
**Category:** How do I?\
**Created:** [September 16, 2024, 4:49pm UTC](https://community.weweb.io/t/reusable-formulas-with-variable/12632 "2024-09-16T16:49:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![masterads](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@masterads](https://community.weweb.io/u/masterads)\
**Post date:** [September 16, 2024, 4:49pm UTC](https://community.weweb.io/t/reusable-formulas-with-variable/12632/1 "2024-09-16T16:49:09Z")

</div>

Hello everyone,

When I create a reusable formula, how do I define which value is going to be used as a variable?

Let’s say I create a simple formula that always multiply a number from an input 1,000 times, so:  
‘input a - value’ \* 1000

Then I name this formula “mult1000” and it becomes available as “mult1000()”.

Is it possible to make “input a - value” replaceable and then pass the variable inside the formula, like: mult1000(‘input b - value’)

It probably has a very simple answer that I was not able to find in the documentation.

---

<div class="post-metadata">

**Author:** ![archenia\_jsanchez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/archenia_jsanchez/32/8656_2.png) [@archenia\_jsanchez](https://community.weweb.io/u/archenia_jsanchez)\
**Post date:** [September 16, 2024, 6:17pm UTC](https://community.weweb.io/t/reusable-formulas-with-variable/12632/2 "2024-09-16T18:17:39Z")

</div>

I imagine you are looking to add parameters to the formula, then create the formula referencing those parameters, and lastly, passing parameters into the formula when referencing it in the project.

In the screenshots below, I’ve created a formula called `multiply` which has 2 parameters: `a` and `b` (which are set to 1 and 1,000 for testing). I then edit the formula so that these 2 parameters are used, which you’ll see in the popover to the right. These parameters can be found under the tab with the lightning bolt icon.

 ![Screenshot 2024-09-16 at 1.59.47 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/8de1eb5d7f27241945523fe92c82e8e9c1918156.png)

> Tip: if you add a description for the formula, it will output as a tooltip to provide nice hint text. See last screenshot for example of tooltip with hint text.

 ![Screenshot 2024-09-16 at 2.14.26 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b0d2854912f0eec982ffe081a2f4cabfb2740af9.png)

With the formula built, I can now reference it in my project. Below you’ll see I am binding to text, and setting that text to the output of my formula, in which I decided to pass 2 and 1,000.

 ![Screenshot 2024-09-16 at 2.12.32 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b7d8046ff95f74465a21855faf3a4d35650c8f5c.png)

---

<div class="post-metadata">

**Author:** ![masterads](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@masterads](https://community.weweb.io/u/masterads)\
**Post date:** [September 16, 2024, 6:20pm UTC](https://community.weweb.io/t/reusable-formulas-with-variable/12632/3 "2024-09-16T18:20:15Z")

</div>

That’s exactly what I was looking for and failed to figure out on my own.

Thank you so much!
