Make a null value 0?

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Where? In a table, in a query?
Do you actually want to update the value, or just change the display somewhere?

The NZ function can be used in a query to return a zero instead of a Null.
If you need to update the table, you can use an Update Query to update those (and I recommend changing the Default value of the Field to a zero for future entries).
 
Upvote 0
Hi,

Sorry for not being too clear. I would like to change null values in a particular field into 0 using an update query. If it would help explain things a bit better ill give some context. I am currently creating a database that will keep the records of sales and also keep a stock level. When i add a new range of stock into my product table all of the data in the "price" field are null, i would like to change them to zero using a query instead of typing zero into about 30 records.

Thanks for the help
 
Upvote 0
When i add a new range of stock into my product table all of the data in the "price" field are null
If you go into the Design View of your table, and look at the Properties of the "Price" field, what is the Default Value property set to?
If it is set to 0, depending on how you are entering your data, this may take care of the problem and put a zero in there for every new record where a number is not being entered in.

If not, and you still need to create an Update Query to fix them after the fact, that is pretty easy to do with the Query Builder.
1. Create a new query based on your one table and add only the "Price" field
2. On the "Criteria" row, enter Is Null
3. Change the query type to "Update"
4. Enter 0 on the "Update To" row under the Price field.
5. Run the query.

That's it!
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top