Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry if this question is too simple/easy for you guys, but I'm still learning QGIS and pretty much teaching myself where I can.

Is there a way to add data from 2 columns into one new column inside QGIS ?

I have cattle population for each province in a certain country, and buffalo populations for each province in another column (I entered all these manually) - what I'm looking to do is to make a new column (within the same shapefile/database) that combines both cattle and buffalo populations in each province.

I've tried using the field calculator, get error messages all the time - not sure if I have my functions wrong. With the field calculator, I've been trying to enter a simple function of

Catt Pop + Buff Pop

with a new output field as Real number data, but I get error messages such as:

"Invalid expression syntax. The error message of the parser is: 'syntax error, unexpected COLUMN_REF, expecting $end'"

Secondly - if I can't do this in QGIS, is the only way to open the relevant dbf file in open office and then edit it and then save and load again? From the manual that I read to learn GIS, this can be done but is not recommended (by the guys who wrote the manual) - does anyone have any links to any foolproof guides on how to do this anyway since I've never done it?

Thank you so much for your time.

share|improve this question
up vote 8 down vote accepted

The syntax problem is most likely caused be the spaces in column names. If you double-click the column names in field calculator, they will most certainly be added with quotation marks, e.g.

"Catt Pop" + "Buff Pop"
share|improve this answer
Worked. Thank you for your time. – KkBkk Jun 10 '12 at 18:59
@KkBkk If your problem is solved, please accept the answer so that this thread can be marked as answered. Upvotes are welcome too. They are a way to reward users who donate their time to answer questions. – underdark Jun 10 '12 at 19:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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