Using formula fields

Formula fields instantly perform calculations based on values entered into other fields on your application form. To create a formula, you’ll need to reference the Short titles or slugs of the fields involved.

Configure a formula field

  1. In the Manage workspace, go to Applications
  2. Click Edit form and choose your form
  3. Find where you want to place your formula field, hover your cursor, and click the + icon
  4. In the configuration tray, choose Formula from the Field type drop-down
  5. Add a Label and Short title
  6. (Optional) Add Hint text or Help text for added context
  7. In the 'Options' section, enter your formula using the functions listed below
  8. Click Save

Available functions

The formula field supports a number of different functions, many of which will be familiar if you use formulas in Excel and other spreadsheet tools. Here are some examples of what you can do.

Number and currency fields

Average
Takes the average of the specified fields
average({field1},{field2},{field3},{field4})
Sum
Sums the specified fields
sum({field1},{field2},{field3},{field4})
Min
Returns the smallest number of the specified fields
min({field1},{field2},{field3},{field4})
Max
Returns the largest number of the specified fields
max({field1},{field2},{field3},{field4})
Round
Rounds to specified number of decimal places
round(number,count)
Round up
Rounds up to specified number of decimal places
roundup(number,count)
Round down
Rounds down to specified number of decimal places
rounddown(number,count)

 

Strings

Concatenate
Combines several text strings into one string
concatenate({field1},{field2},...{fieldn})
Exact
Returns true if both strings are exactly the same
day({field1},{field2})
Left
Extracts a given number of characters from the left side of a text string.
left({field},4)
Lower
Converts the text to lowercase
lower({field})
Mid
Returns a substring of a given length starting from a specific position
mid({field},start_position,length)
Proper
Capitalises the first word of a string
proper({field})
Replace
Replaces a substring of a given string
replace({field},start_position,length,"new string")
Right
Extracts a given number of characters from the right side of a text string.
 
right({field},4)

 

Dates

Today
Returns today's date
today() 
To format the date use text(today(),"MM/DD/YYYY")
Days
Calculates the difference between two date values
days({field1},{field2})
Month
Returns the month for a date value
month({field1})
Year
Returns the year for a date value
year({field1})
Day
Returns the day for a date value
day({field1},{field2})
Edate
Shifts the date by the given number of months
edate({date},months)
To format the date use text(edate({start},3),"dd/mm/yyyy")
Hour
Returns the hour for a given time
hour({time})
Now
The current date and time
now()
To format use:
text(now(),"dd/mm/yy hh:mm:ss")
Weekday
Returns the number that corresponds to a day of the week
weekday({field})
Week number
Returns the number that corresponds to the week of the year
weeknum({field})

Age

Returns the age for a given date

rounddown(days(today(),({DOB}))/365,0)

Countdown

Calculates the days and hours until a given date and time

days({Date 2}, {Date 1}) & " days, " & hour({Date 2}) - hour({Date 1}) & " hours"

 

Engineering

bin2dec
Converts a binary number to decimal
bin2dec({field})
bin2hex
Converts a binary number to hexadecimal
bin2hex({field})
dec2bin
Converts a decimal number to binary
dec2bin({field})
dec2hex
Converts a decimal number to hexadecimal
dec2hex({field})
delta
Returns true(1) if both numbers are equal otherwise false(0)
delta({field1},{field2})

 

Information

isnumber
Returns true if the field contains a number
isnumber({field1})
iseven
Returns true if the field contains an even number
iseven({field})
isodd
Returns true if the field contains an odd number
isodd({field})
istext
Returns true if the field contains text
istext({field})

 

Logical

if
If/then test
if({field1}>1000,"then value1", "otherwise value2")
and
Returns true if all arguments are true
and({num1}=3, {num2}=3)
or
Returns true if at least one argument is true
or({num1}=3, {num2}=3)

Example

If you want to calculate the year-on-year growth in revenue for two fields with short titles "2020" and "2021" you would reference each field as {2020} and {2021} in your formula. Here's how it will look:

({2021}-{2020})/{2020}*100

To round the result to two decimal places you can use the round function as follows:

round(({2021}-{2020})/{2020}*100,2)

Good to know

  • Formulas must be enclosed in curly braces: {}.
  • Formulas are calculated client-side, meaning the calculation happens in the user’s browser. Because of this, the formula field and any fields it references must be visible to the user viewing the page.
  • All field types are supported except table fields, content fields, and other formula fields.
  • Formula fields support up to 120 nested functions.
  • There is no need to add an equals sign at the start of a formula.
  • Formulas reference field slugs, not short titles. Updating a field’s short title later will not break existing formulas.
  • Calculated values are saved to the application when the application is saved. This allows formula fields to be added as columns in views such as Applications in the Manage workspace.
  • Updating a formula after applications already exist will automatically recalculate all stored values.

To learn about other field types supported by Good Grants, check out our guide: Field types.

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more