I have an attribute table with a real data type column named "Volume". Some of these cells have no value, and I want to replace the NULL with a dummy value like -999. In the Field Calculaor I select "Update Existing Field", select the "Volume" field and I attempt the following:

1) I code CASE WHEN NULL THEN -999 END - Result: the entire column becomes NULL.

2) Then I try CASE WHEN "Volume" IS NULL THEN -999 END - Result, the NULL valued cells now show -999 BUT all the other formerly filled cells are now NULL. After many hours of trying other expression variations I can't figure this out. My guess is I am missing a basic concept.

Oh, and how can I "undo" a bad field calculator update besides quitting QGIS and discarding the updates.


2 Answers 2


You need to include an ELSE statement, like this:


Not sure about undoing a bad expression other than toggling off editing and not saving your changes.


Use the select feature by expression to select all the rows that have a NULL volume. enter image description here

Then open the field calculator. Select "update existing", select your "Volume" field, and select the "Only update Existing" option. Type in the value you wish to update to and select okay. Example is pictured below. enter image description here

  • "Select by Expression" worked.
    – user88851
    Jan 19, 2017 at 22:33

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