I have a string of values (over 10,000) I want to label them but I don't want to label every single one. I need to label every fifth number.
One solution: create a new column of type integer. Using field calculator, assign the value using the $rownumber variable.
Then, enter the following logic into the "Show label" option in rendering parameters of the label dialog:
[new column name] % 5 = 0
The % is the modulo operator - it represents the remainder of the first number after dividing by the second number. [new column name] would be the column that you created. In essence, you're telling the computer to divide the row number of each entry by 5 and test if the remainder is 0. If it is, then the feature gets labeled.
Using QGIS 2.0.1, you can use an expression directly in the labelling tab in order to get what you need :
CASE WHEN $id%5 =0 THEN "yourfield" END
in other words, if your id value ($id is built in) is divided by 5, then label with the value in "yourfield"