Power Query Problems

How to Fix Power Query Null Date and Logical Value Errors

Kushani NimanthikaKushani Nimanthika Nov 11, 2026 869 views

Question details

The user needs to resolve an error occurring in Power Query when a custom formula evaluates a column containing null values.

How to Fix Power Query Null Date and Logical Value Errors
Product
Excel Power Query
Device & OS
not provided
Scenario
Writing custom conditional formulas or M code that compares values in nullable columns, such as Termination dates or Compensation amounts.
Observed behavior
Power Query returns a data type conversion error stating that a null value cannot be converted to type Logical.
Before you start

Review your dataset to identify which columns, especially dates and numeric fields used in your logical comparisons, contain empty cells or null values.

Solution 1Recommended

Test for Null Values Before Making Logical Comparisons

Modify your custom formula to explicitly check if a value is not null before applying logical operators like greater than or less than.

Power Query uses short-circuit evaluation for the 'and' operator. By testing for nulls first, you prevent the query from attempting to evaluate the actual date or number condition on an empty cell, which avoids the logical conversion error.

1
Open the formula editor

In the Power Query Editor, open the Advanced Editor or the Custom Column dialog where your formula is located.

2
Update the conditional logic

Add a condition to check for nulls at the beginning of your evaluation. For example, change your logic to: [Termination] <> null and [Termination] > #date(2023,3,31).

3
Apply to other nullable columns

Expand this same conditional check to any other fields used in comparisons, such as Compensation or additional date columns.

Short-Circuit Evaluation: Because Power Query stops evaluating an 'and' statement once it finds a false condition, the error is completely bypassed for null records.
Free Microsoft Office alternative

Handle Complex Data Easily with WPS Office

While Power Query errors in Excel can be complex and time-consuming to troubleshoot, WPS Spreadsheet offers intuitive, built-in tools for data cleaning, conditional formatting, and logical formulas without the steep learning curve. Enjoy a lightweight, highly compatible alternative to Microsoft Excel.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installer for your operating system.
  2. 2. Install and Open: Run the setup file and launch WPS Spreadsheet to access your workspace.
  3. 3. Open Excel Files Directly: Drag and drop your existing .xlsx workbooks into WPS Spreadsheet to continue editing your data seamlessly.
Free and lightweight office suite for all devicesSeamless compatibility with Microsoft Excel formats (.xlsx, .xls, .csv)Built-in intuitive data cleaning and conditional sorting toolsFamiliar user interface requiring no retraining
microsoft office alternative - wps office

Frequently Asked Questions

Why does Power Query say it cannot convert a null value to Logical?

This happens when your custom formula expects a true or false (logical) result from a greater-than or less-than comparison, but it encounters an empty (null) cell instead. Power Query cannot compare a null value to a standard date or number without explicit handling.

How do I handle null dates in Power Query custom columns?

You can handle null dates by checking if the field is not empty before evaluating it. Use the syntax `[DateColumn] <> null` combined with the `and` operator. This ensures the date comparison only runs if the cell actually contains a date.

Can I replace null values in multiple columns at once in Power Query?

Yes. Select multiple columns by holding down the Ctrl key, right-click on one of the selected column headers, and choose 'Replace Values'. You can then replace 'null' with a specific placeholder value across all the selected columns simultaneously.