When you create a Virtual Question, one of the Optional Presets available is the variable age_range. This preset automatically adds logic for the platform's preset age ranges: 13-17, 18-24, 25-34, 35-44, 45-54, 55-64, 65-74, and 75+.
These ranges are fixed by the platform—they aren't based on your survey's target audience. Every range appears in the preset even if your survey doesn't include that age group. For example, a survey fielded to respondents 18 and older still shows a 13-17 option, which will capture 0 respondents.
⚠️ Note: Surveys fielded before October 30, 2023, use seven ranges instead of eight. On these surveys, 65-74 and 75+ are consolidated into a single 65+ range, written as age_range = '65+'. Logic that uses '65-74' or '75+' won't match any respondents on these surveys.
There are two ways to adjust these ranges to fit your needs.
In This Article
Combining preset age ranges
You can combine several preset age ranges into one answer option in either basic mode or advanced mode. Both methods produce valid logic.
Using basic mode
- With Age range selected in the first drop-down of an answer option, click the second drop-down.
- Check the box next to each age range you want to include. The logic is written using the in operator—e.g., age_range in '13-17', '18-24'.
- Repeat for each answer option, as appropriate.
- Hover over any now-duplicate answer option and click the X on its left to delete it.
Using advanced mode
- Hover over an answer option and click switch to advanced mode.
- After the existing logic, add the operator or and select the next age range from the autocomplete suggestions—e.g., age_range = '13-17' or age_range = '18-24'.
- Repeat for each answer option, as appropriate.
- Hover over any now-duplicate answer option and click the X on its left to delete it.'
⚠️ Note: Preset ranges can't be edited to capture a custom group of ages—basic mode only lets you choose from the fixed options. To define your own ranges, see the next section.
Creating custom age ranges
To set up your own age groupings, write logic using the variable age, which captures the exact age of a respondent, with mathematical operators. For example:
- age = 18 captures all respondents who are exactly 18.
- age < 30 captures all respondents under the age of 30.
- age >= 50 captures all respondents age 50 or older.
When the age_range preset is in use, age isn't listed in the answer option drop-down, so custom ranges must be written in advanced mode.
- Hover over an answer option and click switch to advanced mode.
- Replace the logic with age >= # and age <= #, where the # values are the minimum and maximum ages for your custom range—e.g., age >= 18 and age <= 29.
- Repeat for each answer option, as appropriate, with the adjusted ages.