# How to replace null values with 0

By utilizing an [IF](https://docs.cascade.io/cascade/functions-and-expressions/functions/logical/if) Statement in conjunction with [ISNULL](https://docs.cascade.io/cascade/functions-and-expressions/functions/logical/isnull), you can easily replace any null values with 0.

<figure><img src="https://2577551913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_FvcY52Jcyt8JHFGs%2Fuploads%2FtWQnVKQHRCjDJ4hRtn89%2FReplace%20null%20values%20with%200-1.png?alt=media&#x26;token=752f458c-e37d-4e28-befa-8b77324928c9" alt=""><figcaption><p>Null values in a table</p></figcaption></figure>

The syntax for this is simply: IF(ISNULL(\[column]), 0, \[column]).

<figure><img src="https://2577551913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_FvcY52Jcyt8JHFGs%2Fuploads%2FGu1Xmlw8B5Fk9NdaBT8w%2FReplace%20null%20values%20with%200-2.png?alt=media&#x26;token=55c70d37-8065-4d59-8704-df7366417913" alt=""><figcaption><p>Using the Expression Editor to write an <a href="../../functions-and-expressions/functions/logical/if">IF</a> statement</p></figcaption></figure>

This statement will check to see if the value is null. If it is, it will replace it with 0; on the other hand, if not, it will preserve the original value in the column being tested.

<figure><img src="https://2577551913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_FvcY52Jcyt8JHFGs%2Fuploads%2FH07U6gWLktqTVcGyN6r9%2FReplace%20null%20values%20with%200-3.png?alt=media&#x26;token=1ab68928-d19f-4856-87bc-f6e8ecb0e002" alt=""><figcaption><p>All null values are replaced with a zero in a calculated column</p></figcaption></figure>

{% hint style="info" %}
Remember to use the [Edit Columns](https://docs.cascade.io/cascade/tools/transform/editcolumns) tool to add a new calculated column with the [ISNULL](https://docs.cascade.io/cascade/functions-and-expressions/functions/logical/isnull) function.
{% endhint %}

## Another Method - [Find Replace](https://docs.cascade.io/cascade/tools/cleaning/findreplace)

You may also find it easier to use a [Find Replace](https://docs.cascade.io/cascade/tools/cleaning/findreplace) tool to replace all null values in the entire table, or in specific columns with your desired value; in our case, 0.

<figure><img src="https://2577551913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_FvcY52Jcyt8JHFGs%2Fuploads%2FADGUa4SG2XZqqJNO8OIS%2FReplace%20null%20values%20with%200-4.png?alt=media&#x26;token=01bddf1f-e9b9-4932-a97b-6cb284fcdce5" alt=""><figcaption><p>All null values are replaced with a zero in their origin column</p></figcaption></figure>

### Related Questions

<details>

<summary>How can I substitute null values with 0?</summary>

You can substitute null values with 0 by using an IF Statement in conjunction with ISNULL, or by using the Find Replace tool.

</details>

<details>

<summary>What is the IF syntax for replacing null values with 0?</summary>

The syntax to include in an IF statement to replace null values with 0 is IF(ISNULL(\[column]), 0, \[column]).

</details>

### Other Sources

{% content-ref url="../../functions-and-expressions/functions/logical/if" %}
[if](https://docs.cascade.io/cascade/functions-and-expressions/functions/logical/if)
{% endcontent-ref %}

{% content-ref url="../../functions-and-expressions/functions/logical/isnull" %}
[isnull](https://docs.cascade.io/cascade/functions-and-expressions/functions/logical/isnull)
{% endcontent-ref %}

{% content-ref url="../../tools/cleaning/findreplace" %}
[findreplace](https://docs.cascade.io/cascade/tools/cleaning/findreplace)
{% endcontent-ref %}
