Setting up Custom Redirect Formulas and Nesting @IF() Statements 


In this Article
Related Articles
  • None

Getting Started

Once a respondent submits a form, you can use redirect formulas to send them to different websites or forms based on a selection within the form they just submitted. You can also use redirect formulas when setting up form-to-form prefilling

When creating a redirect formula you will always want to start with this basic structure:

@IF(condition,"do this if true","do this if false")

Here's an example of what this might look like in action:

@IF(%%tfa_34%%="No","http://google.com","http://yahoo.com")

In other words, if field 34 is answered with "No" it will redirect the respondent to Google. If not, it will go to Yahoo.

This practice is most common with single or multiple-select fields within your form (i.e., radio buttons, lists, checkboxes, and dropdown menus).  When creating a formula like the one above, you will need to make sure that the text in your formula exactly matches the selected text within your form field, including spacing and capitalization.  In other words, if your users select "Sign me up" from a dropdown menu, your formula would need to reflect that text exactly.

Please Note:  The redirect formula has a character limit of 2,000 characters.  We are unable to increase this limit.

Now, say you have multiple conditions that you want your formula to be based on, you will need to nest them:


Nesting 2 Formulas


2 Individual formulas:

@IF(%%tfa_34%%="No","http://google.com","http://yahoo.com")
@IF(%%tfa_34%%="Yes","http://msn.com","http://yahoo.com")

Nested:

@IF(%%tfa_34%%="No","http://google.com",@IF(%%tfa_34%%="Yes","http://msn.com","http://yahoo.com"))

In other words, if field 34 is answered with "No" it will redirect to Google. If not, and if field 34 is answered with Yes, they will be redirected to msn.com. If neither of those are true, it will redirect to Yahoo.


Nesting 3 Formulas

Let's add another:

@IF(%%tfa_34%%="Almost","http://abc.com","http://yahoo.com")

With all 3 nested:

@IF(%%tfa_34%%="No","http://google.com",@IF(%%tfa_34%%="Yes","http://msn.com",@IF(%%tfa_34%%="Almost","http://abc.com","http://yahoo.com")))

In other words, if field 34 is answered with "No" it will redirect to Google.  If not and field 34 is answered with "Yes" they will be redirected to msn.com. If not and field 34 is answered with "Almost" they will be redirected to abc.com. Finally, if none of those are true, it will redirect to Yahoo.


Troubleshooting Redirect Formulas

There are a few things you should always avoid when working with redirect formulas (or with formulas in general).

1. Spaces: Make sure that your formulas do not contain spaces. Sometimes spaces can be easy to miss, especially if they're at the beginning or end of a formula. Always double-check that your formula is free of spaces. The only exception to this would be if you're referring to a field value, which should always be within quotes. For example, in the formula: @IF(%%tfa_1%%="Sign me up","http://www.google.com","http://www.yahoo.com) the spaces are used inside of the quotes, which is acceptable.

2. Curly Quotes: If you are creating your formula in another text editor like Microsoft Word and then copying the formula over, you may end up with "curly quotes." These are quotes that are curled on the end, as opposed to being straight up and down(" vs. ”). This may seem like a small detail, but formula syntax will not be recognized if there is a curly quote within the formula.

3. A## In Formula Output: If you are seeing A## (e.g., A23) in a formula output, then please visit this page for additional troubleshooting steps.

Terms of Service · Privacy Policy