# How to Cap Weights

From Q

*Capping* a weight refers to limiting the maximum value that a weight can take. For example, where weights are *capped* at 5 it means that any weight computed to be greater than 5 is returned as a 5. It is done in Q as follows:

- Create a weight in one of the usual ways.
- In the Variables and Questions tab select the weight variable.
- Right-click on the weight variable and select
**Copy and Paste Variable(s) > Linked**. - Right-click on the newly created variable (which is under the one that was copied) and select
**Edit Variable**. - Create appropriate entries for
**Name**and**Label**and set**Expression**to`Math.min(maxValue,weightVariable)`where`weightVariable`is the name of the variable that is the current weight and`maxValue`is the maximum value that you wish the weight to take (i.e., the*cap*). - Review the
**Result**field in the**Preview of results**and press**OK**. - Press for the new weight variable.
- Apply the newly created weight on the tables and charts to be weighted on the Outputs Tab.