Power Query Problems

How to Identify Physical Addresses and Fill Blank Columns in Power Query

Aamir Naveed AkramAamir Naveed Akram Oct 13, 2026 870 views

Question details

The user needs to correctly identify physical addresses from columns containing mixed data types (like phone numbers and emails) and move them into a designated address column while routing location IDs elsewhere.

How to Identify Physical Addresses and Clean Inconsistent Columns in Power Query
Product
Microsoft Power Query
Device & OS
not provided
Scenario
Sorting approximately 4,000 customer records where physical addresses, phone numbers, email addresses, and location identifiers are haphazardly mixed across three different columns.
Observed behavior
Simple conditional formulas checking for blank cells fail because non-blank cells often contain incorrect data types (such as an email address) rather than the required physical address.
Before you start

Before applying advanced queries, extract a representative sample of your raw data in text form to clearly identify patterns (like numbers starting an address) and define strict sorting rules.

Solution 1Recommended

Extract Addresses Using Custom Conditional Logic

Use text-based logical rules to check if a string matches a physical address pattern instead of relying on blank-cell detection.

Because the data formats are highly inconsistent, a simple conditional formula will mistakenly pull in emails or phone numbers if it only checks whether a cell is empty. Establishing specific text-based rules ensures that only legitimate addresses are moved into the primary address line.

For example, you can build logic to verify if a text string begins with a number (common for physical street addresses) and does not contain an '@' symbol.

1
Add a Custom Column

Open the Power Query Editor, navigate to the 'Add Column' tab, and click on 'Custom Column'.

2
Define the Address Pattern

Write an M formula to check for address characteristics, such as using the Text.Start function to determine if the first character of the cell is a number.

3
Filter Out Unwanted Data Types

Create a secondary rule or conditional column to identify emails by searching for the '@' symbol and phone numbers by checking string length or formatting, routing them to separate columns.

4
Route Location Identifiers

For the remaining unidentified text strings that are neither addresses nor contact info, route them to your 'AddrLine2' column to serve as location identifiers.

Extract Addresses Using Custom Conditional Logic
Pattern Matching Limitations: If your physical addresses do not consistently start with a number (e.g., PO Boxes or building names), you will need to add those specific keywords to your custom column logic.
Free Microsoft Office alternative

Effortlessly Manage Complex Spreadsheets with WPS Office

Dealing with messy data arrays in Microsoft Excel can be overwhelming. WPS Office provides a lightweight, fast, and feature-rich alternative with highly accessible built-in data cleaning tools, allowing you to organize your spreadsheets easily without advanced coding skills.

  1. 1. Download WPS Office: Download and install the free WPS Office suite from the official website.
  2. 2. Open Your Data File: Open your messy dataset or Excel file directly in WPS Spreadsheet with perfect compatibility.
  3. 3. Clean Your Data: Utilize the 'Data' tab tools like 'Text to Columns', 'Remove Duplicates', and advanced filtering to clean and sort your records effortlessly.
Fully compatible with Microsoft Excel file formats (.xlsx, .xls, .csv)Familiar user interface ensures a seamless transition with zero learning curvePowerful data filtering, sorting, and text-to-columns features built-inCompletely free and lightweight alternative to costly Microsoft Office subscriptions
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the 'if blank' formula work for messy address data in Power Query?

If a column contains a random mix of addresses, phone numbers, and emails, checking for a blank cell only verifies if the cell is empty. It cannot verify if the text inside a non-blank cell actually represents a physical address, resulting in incorrectly sorted data.

Can I use regular expressions (Regex) in Power Query to find addresses?

Power Query does not support Regex natively in M code. To use pattern matching, you typically have to build custom logical formulas, or use the Web.Page function to run JavaScript Regex, which can significantly slow down your query processing.

How do I handle inconsistent address columns without writing complex code?

The most straightforward no-code approach is to merge all the inconsistent columns into a single text column. Once merged, you can use the 'Split Column by Delimiter' function and basic text filtering to manually separate emails, phone numbers, and physical addresses.