I have a shape file with point numbers for individual ID's. I would like to select point numbers divisible by a number, and if the remainder is 0 then I would like to label that point.

I have tried about 1000 different combinations using the Modulo operator, but I continue to get an "Expression is invalid" error.

Pseudocode for the expression is as follows:

When % ("Point_Number", 7) = 0
Then "Point_Number"
  • 2
    What software are you using?
    – Dan C
    Commented Sep 24, 2014 at 16:27
  • There was a similar question recently in which the OP wanted to select contours with at an interval of 50 m. The modulo function was used. The answer might be of use to you for your application: gis.stackexchange.com/questions/114012/… Commented Sep 24, 2014 at 16:31
  • If it's ArcGIS that you're using, then based on Edixon's answer to the question I linked to, I'd say your expression should read: MOD("Point_Number", 7)=0, where Point_Number is your attribute field ID (notice that it's longer than 10 characters) and 7 is the interval that you want to select, i.e. select every 7th feature. Commented Sep 24, 2014 at 16:43
  • Sorry, I forgot to mention I am using QGIS. I get this to work all of the time in other software packages, but I guess I am not familiar enough with the syntax necessary in the Labeling Expression Builder to do this properly
    – jbgramm
    Commented Sep 24, 2014 at 18:16

2 Answers 2


Here's an expression that should work:

case when "Point_Number" % 7 = 0 then "Point_Number" end
  • That is excellent! Thank You Very Much! I tried just about everything I could think of based upon the syntax from other packages that I have used. I simply made it too complicated. Thank you again!
    – jbgramm
    Commented Sep 24, 2014 at 22:32

It's also possible to use the Feature Filter (in properties -> source). In the query builder you can fill in:

"Point_Number" % 7 = 0

if you only want the points divisible by 7.

With point number beeing the attribute where you have unique id's set for your data. If your dataset doesn't, you can always make one by using the field calulator, make a new field, fill in


or double click it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.