When I try to enter the following expression to remove NULLS, it does not appear to be saving/doing anything.

if( "number" IS NULL, 0, "number")

  1. Open Attribute Table
  2. Open Field Calculator
  3. Check Update Existing Field
  4. Double-click Field and Values
  5. Paste this expression on my applicable value
  6. Press OK

My field still appears NULL for all rows.

Edit: I am working with a joined field.

2 Answers 2


The expression is correct, the only issue I can think of is that you didn't select the target field from the drop-down menu. The one you need to update:

enter image description here

Here is the result:

enter image description here

I used QGIS 3.4.5.

  • My desired field does not appear in the drop down. If it helps, this Attribute Table is my shape file, and the field I'm trying to remove the NULLs from is from my data set.
    – Jon
    May 24, 2019 at 1:39
  • 2
    @Jon The field name is invalid that is why you cannot see it in the drop-down list. The field name cannot exceed 10 characters in shapefile: pro.arcgis.com/en/pro-app/tool-reference/…. Also slash character / is invalid. You need to create another field with correct name (no special characters) and length.
    – ahmadhanb
    May 24, 2019 at 2:20
  • Thank you. I've shortened the name, but it still automatically adds the underscore before it. It's now "AA_Arabic." "AA" referring to my data spreadsheet. "Arabic" the data column in my table. How can I change the name to remove the underscore?
    – Jon
    May 24, 2019 at 2:40
  • 1
    ah, looks like in your original question you failed to mention that you're trying to do this on a joined field! maybe do the join, then export the file to a new shapefile so that the joined field is embedded in the shape.
    – SaultDon
    May 24, 2019 at 3:49
  • 2
    @Jon You should mention in your question that you are working with joined field. SaultDon comment should fix the issue by exporting the shapefile into a new file to make the join permanent.
    – ahmadhanb
    May 24, 2019 at 4:21

Editing a field in-place (i.e., writing output to it when it itself is the input) appears to not be working because you're doing this on a joined field. A work-around, as long as you it's not a problem to lose the join, would be to use your expression as it is, but write to a new column; then delete the previous column that contains NULL values; and then rename your new column to the same name as the old one.

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.