I have a big data with the parcel numbers of different communities. Now I want to join the parcel numbers of the attribute list with an excel table. Since they need to have something in common to realize the join, I have to get the parcel numbers into the same structure like the excel table.

The parcel number of the attribute list look for example like this: [803, 1] In my excel table I created the same structure, but since there might be the same number in different communities, I had to separate them, that’s why I choose to use another number for each community. For example: [803, 1]_1 (1 for community A) , [803, 1]_2 (2 for community B).

The problem is that I don´t know how to create this formula in my attribute table without having to edit each parcel number. Is there a formula to use? In the attribute table I have the parcel number like this [803, 1] and also the community number like this [08, 8030]. I add a picture of my attribute table, so I think its easier to understand what I need.

enter image description here

Is there a formula that says for example something like this: when in “Gemarkung” [08, 8030], then in “Flurstueck” [621, 4]_1 and when in “Gemarkung” [08, 8015], then in “Flurstueck” [195, ]_2 (of course in "Flurstueck should be the same number and just add _2 or _1...) I hope I could explain myself with what I need.

I am using QGIS version 2.12.3 Lyon.


1 Answer 1


Depending on if you have a reasonably small amount of communities, you could use something like the following by going to the Field Calculator and selecting to either create a new field or update "Flurstueck":

WHEN "Gemarkung" = '[08, 8030]' THEN "Flurstueck" + '_1'
WHEN "Gemarkung" = '[08, 8015]' THEN "Flurstueck" + '_2'
ELSE "Flurstueck"

If you have a quite a large amount of communities then you should probably edit your question to include more details such as the number of communities you have, if they follow a pattern in their attributes etc.

  • 1
    Thats perfect! thank you so much! Its amazing what QGIS can do with the right formula...!
    – user69896
    Jun 7, 2016 at 8:31
  • @user69896 - Most welcome! Yup, took me a while to understand how the SQL-based formulas worked ;)
    – Joseph
    Jun 7, 2016 at 9:00

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.