Power Query - count null in specified columns

JugglerJAF

Active Member
Joined
Feb 17, 2002
Messages
297
Office Version
  1. 365
Platform
  1. Windows
I have some data (dummy data screenshot below) from which I want to count the number of null values, but only in the 4 "rating" columns, I'm not interested in nulls in any other columns.

I've worked out how to count the number of NotNull values across all columns, but that's not giving me what I need. This would be so simple in Excel! Why is it so complicated in Power Query?!?

Can anyone shed any light on this problem and advise how to calculate the number of null values across all 4 of the "rating" columns? The results (reading down) should be 4, 0, 0, 2, 3
 

Attachments

  • CountNullInSpecifiedColumns.png
    CountNullInSpecifiedColumns.png
    14.6 KB · Views: 93

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
The formula for getting a true/false on a null cell is " = null". The formula will return a 0 (false) or a 1 (true).

In the Power Query editor, go to Add Column > Custom Column

For each column you want to test, use this format ([column name] = null) and add them all together using + sign.

For example, you might use: ([Sales] = null) + (RatingQ1 = null) + (RatingQ2 = null).............etc. Each one that has a null value will return a 1, so the result will be the total columns with "null"
 
Upvote 0
Solution
The formula for getting a true/false on a null cell is " = null". The formula will return a 0 (false) or a 1 (true).

In the Power Query editor, go to Add Column > Custom Column

For each column you want to test, use this format ([column name] = null) and add them all together using + sign.

For example, you might use: ([Sales] = null) + (RatingQ1 = null) + (RatingQ2 = null).............etc. Each one that has a null value will return a 1, so the result will be the total columns with "null"
Thanks for the info. I couldn't quite get into work as you stated, getting an error that + was not a valid operator to use with a TRUE/FALSE value, but I resolved it by converting TRUE to 1 with an IF command (might also work by multiplying the TRUE/FALSE by 1 to convert to a numeric value)
 
Upvote 0

Forum statistics

Threads
1,215,250
Messages
6,123,887
Members
449,130
Latest member
lolasmith

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