I am fairly new to QGIS and search as I might in the manual, training manuals and widely on the net I can't find an in-depth explanation of how to set up a Decimal Number (real) field in my attribute table properly.

I have a number of vector layers, each with a polygon on them. I need to add a decimal field to manually insert a rate per 1,000 of the population. The number is more than likely going to be between n.n and nn.n

I have tried all sorts of different width and precision figures, but either the field is too small to take the number, or it is large enough, but I can't get a decimal point in there. Does this mean that the decimal number is less than one?

When I have entered some information into the cell and pressed Enter the cell always reverts to NULL.

Please help!



  • If you have to deal with shapefile attribute tables a lot, then i would suggest the "table manager" plugin, which allows field reordering/renaming.
    – til_b
    Jul 29, 2013 at 12:42
  • After you get it added you can decide how many decimal places to display/label/etc. so add precision for what you need and then change how you use it.
    – Brad Nesom
    Jul 29, 2013 at 13:51

2 Answers 2


To add a decimal column follow these steps:

  1. Open feature table
  2. Start edit session on feature
  3. Click New column button
  4. Enter the following (precision refers to number decimal places), see caption below

enter image description here

Then, manually add or calculate values into your new column


You can use "New Column" tool in attribute table of your layer.

Width represent the total number of digits. Precision represents the number of decimals


Width 5 Precision 3

  • -2.001
  • 99.999

Width 3 Precision 1

  • 0.1
  • 1.2
  • 99.9

Width 20 Precision 9

  • 11123456789.123456789

If your calculations are getting NULL values, first try to save and refresh your table attribute.

If the problem persist, make sure that the output of your calculus is a number and not a text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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