Knowledge Base

Using If-statements in formulas | INTERMEDIATE

‘If-statements’ can are can be used in a Quickbase formula field to evaluate whether a condition is true, then return one value if the condition is true or a different value if it’s false. For instance, an ‘if-statement’ can evaluate whether a student received a passing or failing grade based on the value of a [Test Score] field.

Simply add a new formula field to your form and enter an ‘if-statement’ to display whether student’s ‘pass’ or ‘fail’ a test.

Here are the steps for setting up your “Pass/Fail” field;

  1. Go to the table that contains the [Test Score] field and add a new field with the field type Formula Text*.

EDITORS NOTE: The field type should correspond to your final output. For instance, if you want to return “Pass” or “Fail”, use a Formula – Text Field. If you want to return a date or a number, you would use a Formula – Date field or a Formula – Number field

  1. Title the new field “Pass/Fail” and go to edit the properties of the field
  2. Enter the formula. The example we are using is: IF([Test Score]<75,”Fail”, “Pass.

There are three components in the above statement. You can see each component is separated by a comma. Let’s review each component:

  1. The first component is called a value test. In this case the value is [Test Score] and we are testing to see if the value is less than 75.
  2. The second component is called the value if true. In this case the value is “Fail”. So if the first component (or condition) is true, the formula will return “Fail”.
  3. The second component is called the value if false. It will return “Pass” if the second component is false (i.e. is not less than 75).
  4. Save the new field and, if necessary, add it the field to your form. You will now see a ‘Pass/Fail’

To test a live example of this field in Quickbase click here For a more advance example of how to use If-Statements click here for an article on how to use Nested If-Statments For a guide/example from our friends at Quickbase, click here.

Copyright ©2021 - Quandary Consulting Group