SurveyMonkey Apply

Using Advanced Expression Piping within your forms you can create mathematical formulas in order to calculate a value. Using a REAL expression, results are displayed as a Single Floating Point (1.0, 2.5, 3.1, etc.) which can be ideal for reporting and display purposes. This article describes this expression further by providing use cases and rules for proper formatting.

The REAL function allows the expression to convert a set of values into an floating point or real value for either a single value or a list of values from a number of given fields. The difference between REAL and REALTWO is that REALTWO returns the value with two decimal places (1.00) whereas REAL converts the value to a single decimal place (1.0).

Additionally, If you are looking to have more than two decimal places within your response, you will need to use PRECISION instead.

The setup and formatting of the REAL expression is imperative in preventing an ** error** message from appearing on your form where the result of your expression would normally appear. The first line of the REAL expression should be set up as follows:

{{ REAL(variable1+variable2) }} |

- Each expression is always contained within a pair of double "curly" brackets {{ }}
- There should be a space between the first instance of REAL and the last bracket
- Variables you are using are case sensitive
- Always close the REAL operation with brackets ( )

What's different about REAL over some of the other functions is that REAL can be used in conjunction with other functions. For example, using the AVG Function, if we want to calculate the average of 3 values, should that value return a floating point, REAL can be used to ensure the value displays up to a single decimal point.

REAL using addition | {{ REAL(q1[0]+q1[1]) }} | Ensures that the sum of q1[0] and q1[1] displays up to a single decimal place. |

REAL using subtraction | {{ REAL(q2[1]-q1[0]) }} | Ensures that the difference of q2[1] and q1[0] displays up to a single decimal place. |

REAL using multiplication | {{ REAL(q1[1]*2) }} OR{{ REAL(q1[2]*q2[0]) }} | Ensures the product of the multiplied values displays up to a single decimal place. |

REAL using division | {{ REAL(q1[3]/4) }} OR{{ REAL(q2[0]/q1[1]) }} | Ensures the quotient of the divided values displays up to a single decimal place. |

REAL with another function | {{ REAL(SUM(q1[:0])) }} OR{{ REAL(AVG(q1[0],q1[2],[q1[3]) }} | Ensure the result of the expression using another function displays up to a single decimal place. |

REAL will not round the value to the nearest number, it will simply remove any additional floating points to meet the Rule, therefore 1.69 will be 1.6 and not 1.7.