# Category:Filters

Related Online Training modules
Applying a Filter
Simple Filters
Complicated Filters
Setting Filters in the Data Tab
Setting Filters in the Variables and Questions Tab
Generally it is best to access online training from within Q by selecting Help : Online Training

It is often useful to view data for only a subset of a sample of respondents; this is called filtering.

## Creating filters

### Tagging existing variables

Any variable in the Variables and Questions tab can be tagged as a filter variable by pressing the button. Any positive values (i.e., greater than 0) are included in the filter.

### Quick method

The most straightforward approach to creating a filter is to select the cells on a table that correspond to the filter you wish to create, and then right-click and select Create filter. This approach will only work where the cells on a table are in some sense mutually exclusive (e.g., it will not work for tables involving grid questions, numeric data and text data).

Note that when you create a filter using this method, it is automatically created as a Binary - Complicated Variable, and is found at the top of the Variables and Questions tab, where it can be edited (by right-clicking on it).

### Binary - complicated variables

A filter can be created using any type of data using Create > Variables and Questions > Variable(s) > Binary - Complicated Variable. See Binary Variable or the relevant Online Training modules listed at the top-right of this page for more information.

### Logic variables

Starting with Q4.11, Logic Variable can be used as filters. These variables use an short and easy-to-use syntax for creating variables. For example, each of the following lines describes a filter, and in many cases the same filter (i.e., illustrating that there are lots of different ways of creating a filter using logic).

useCoke
useCoke(1)
NOT useCoke(0)
age(#1, #2, #3, #9)
age([18 to 24], [25 to 29], [30 to 34], [65 or more])
age(1-3, 9)
age([18 to 24]-[30-34],[65 or more])
age(#1-#3, #9)
age(1-3) OR age(9)
age <= 3 OR age = 9
NOT age([35-44]-[60 to 64])
age >= [55-64] AND {occupation = [Retired] OR gender = [Female]}

### JavaScript

Any JavaScript Variable can be used as a filter.

### Rules and QScripts

The Online Library contains various QScripts and Rules for creating filters.

## Applying filters

Once a filter has been created, it can be applied to any table using the Filter drop-down on the bottom-left of the screen. Each time you apply a filter to a table using a Filter Drop-down Menu at the bottom of the Tables/Outputs Tab, another filter drop-down will appear to its right so that you can easily apply further filters to the same table.

There are two ways of seeing that a filter has been applied. First, the drop-down displays the name of the filter with a green background. Second, the description of the sample size at the base of the screen also shows whether or not a filter has been applied.

To remove a filter, go to the Filter drop-down and select Total sample or press .

## Managing Filters

In larger projects it can sometimes be tricky to change a filter across a large number of tables, particularly when the filter is only applied to some of the tables, or the filter is applied in a different position on different tables. The QScript Filtering - Change Filters on Selected Tables can help save a lot of time when changing filters in a large project.

## Pages in category ‘Filters’

The following 22 pages are in this category, out of 22 total.