SOQL Query to Find Leads With a Blank Email

Find leads with an empty Email using SOQL, including the NULL syntax, blank-string gotcha, and a count-first workflow.

Updated 2026-09-09

Blank required-in-practice fields are the quiet tax on every report. This query lists the leads where Email was never filled in.

Leads are high-churn: they are created by campaigns, converted, and archived, so almost every lead query wants a date or status filter.

The query

In SOQL, NULL is a keyword - it is never quoted and never compared with IS NULL.

Leads missing Email
SELECT Id, Name, Company, Status
FROM Lead
WHERE Email = NULL
ORDER BY CreatedDate DESC
LIMIT 200

Count first, then export

Before exporting, size the problem. If the count is in the hundreds it is a cleanup task; if it is in the tens of thousands it is a process problem upstream.

How big is the gap?
SELECT COUNT()
FROM Lead
WHERE Email = NULL

Text fields can be blank without being NULL

An imported empty string is not the same as a null value in every context. For text fields, check both to be safe.

Null or empty
SELECT Id, Name, Company, Status
FROM Lead
WHERE Email = NULL OR Email = ''

Common mistakes to avoid

  • Use the API name Lead, not the UI label - the two differ on several standard objects.
  • Wrap literal text values in single quotes; date literals such as LAST_N_DAYS:30 must stay unquoted.
  • Run the query in a sandbox first if it feeds a bulk update - a WHERE clause that is one character off can select the whole table.
  • != NULL is the correct way to ask for populated values; there is no IS NOT NULL in SOQL.
  • Formula and roll-up fields cannot always be filtered on - if the query errors, the field is not filterable.

Run it faster with TurboKit

Finding the blanks is easy; fixing them means exporting, editing, and re-importing the same rows.

TurboKit's AI SOQL builder lets you describe the result you want in plain English, returns the query, and exports the rows to CSV or Excel in the same panel - without leaving the Salesforce tab you are already on.

Frequently asked questions

Does SOQL support IS NULL?
No. SOQL uses = NULL and != NULL. IS NULL is SQL syntax and returns a malformed-query error in Salesforce.
Can I filter Lead on a blank picklist?
Yes - an unset picklist compares equal to NULL. A picklist set to a value that was later removed from the value set is still a non-null string, so it will not appear.
Why do some fields error when I filter on NULL?
Non-filterable fields - long text areas, some formula fields, and encrypted fields - cannot appear in a WHERE clause at all.

More from the SOQL Library

Related reading