# IF statements in custom formulas

I’m trying to create a field that will show the percentage of a number that is input in a form. Depending on the number input, the percentage needs to be different.

eg. If the number input is between 0-100, the text field needs to show 1% of that number. If the number input is between 201-300, the text field needs to show 2% of that number.

Is this possible at this time, it doesn’t seem doable from playing around, anyone with a bigger brain than me got any ideas?

As a workaround, you could have multiple text fields (each with the correct percentage) and show each of them only if the correct percentage’s criteria are satisfied? Using the numbers in an action, you’d then have to do different actions, using the different text boxes’ values, also based on the same criteria.
Eg, Field1 is only visible if number input value is between 0-100. When you click a button, you create an action which only operates if the number is between 0-100. You then have Field 2 visible for 100.000001-200, and another action which only runs if the input is valued between 100.000001-200.
The funny decimals are to make sure you don’t accidentally have two actions run if the number is, for example, exactly 100…
Possible, but a bit fiddly!

1 Like

A second option would be to have your option ranges listed as a collection item in the database, and have your ‘submit’ button in a custom list. If you create a collection item with Lower Limit, Upper Limit and Percentage as fields, you could show the custom list of options, stick the list item in a group which only shows if the input number is greater than the Lower Limit and less than the Upper Limit (only show 1 result in the list), and have a single workflow Action on the button in the list which uses the collection item’s percentage.
That might be a bit cleaner!

1 Like

I have tried this concept but when I try to make my text visible. I can only select Equal to or Not Equal to which it means it sees the input field still as a text instead of number.

I have created an input field and set it to number with a custom formal and then I have a text field which then I am trying to set visibility to text field based on the value of the input field. Any idea what I am doing wrong.

Here are the screenshots of the input field and text.

Hi @razimi ,

Add number field in users collection, so you can access them in logged in user field selection.

This can act as app wide variable for this user.

Thank you so much for the info.

1 Like