How to use Conditional Columns in Excel Power Query


Excel formulas are great until you need to stack 10 of them inside each other—one wrong bracket can ruin your entire afternoon. You can skip the headache by moving that logic into Power Query. Conditional columns let you build “if/then” rules visually, keeping your data clean and easier to manage.

First, I’ll walk through how to use the Conditional Column tool, then I’ll show you how to apply it to three common real-world scenarios.

Ditch the parentheses of doom

If you find yourself staring at a formula bar that looks more like a wall of Morse code than a calculation, you’ve likely hit the limits of standard Excel functions. Nested IF statements are the traditional way to handle multiple outcomes, but they’re notoriously difficult to audit. If a single bracket is misplaced, the formula can break entirely. Even when the syntax is correct, a minor logic error can make the results difficult to debug. Power Query’s Conditional Column tool replaces this manual formula writing with a visual, fill-in-the-blank interface.

An illustration featuring the Excel logo, function symbols, and a formula bar showing '=function()' against a green and blue abstract background.


Stop writing nested IFs and IFS formulas in Excel: Use SWITCH instead

Write cleaner Excel logic by eliminating repetitive and lengthy formulas.

While Power Query can pull from any Excel range, I’d strongly recommend that you format your data as an Excel table (Ctrl+T) first. Tables are dynamic, so when you add new rows, Power Query will include them the next time you refresh the query. Once your data is formatted and your table is named:

  1. Select any cell in your table, then go to the Data tab and click From Table/Range to launch the Power Query Editor.
  2. Open the Add Column tab and click Conditional Column.
  3. Start by entering a descriptive label in the New column name field.

To build a rule, you need to fill out a row of four fields:

The four conditional fields in the Power Query Editor Add Conditional Column dilaog.

  • Column Name: The existing column you want to evaluate.
  • Operator: The logic (such as “is greater than,” “contains,” “begins with,” and so on).
  • Value: The threshold or text you’re looking for.
  • Output: What the new column should display if the rule is met.

Notice the small icons next to the Value and Output boxes. By default, these are set to ABC123 (static text or numbers), but you can click them to select a Column Name instead—allowing you to compare two different columns against each other.

To finish the logic, use the following:

The Add Clause button and Else field of Power Query's Add Conditional Column dialog.

  • The Add Clause button: Use this to stack “Else If” rules for multiple tiers.
  • The Else section: This is your catch-all for anything that doesn’t meet your rules, ensuring every row receives an output value.

The interface uses a top-down order of operations. If a row meets the first criterion, it stops there. If not, it moves to the next one.

When you’ve finished, click OK. Power Query places your new column toward the far right by default, but you can rearrange columns afterward by dragging the headers.

The Power Query Editor with a conditional column headed Loyalty Tier.

If you realize you missed a category or need to adjust a threshold, simply double-click the Added Conditional Column step in the Applied Steps pane on the right of the Power Query Editor window and make your adjustment.

Then, go to Home > Close & Load > Close & Load To to load the dataset with your new conditional column to an existing worksheet or a new one. When you add new data to your source table, just right-click the results and click Refresh to apply the logic instantly.

To follow along as you read, download a free copy of the example Excel workbook. After you click the link, you’ll find the download button in the top-right corner of your screen, and when you open the file, you can access each use case on a separate worksheet tab.

Use case 1: Complex tiering

Moving beyond basic categories

Conditional columns turn raw numbers into meaningful groups, making it easier to structure logic and reduce the risk of overlapping conditions when rules are ordered correctly.

The scenario: You need to assign sales reps to a performance tier: anyone over $10,000 is Platinum, over $5,000 is Gold, and everyone else is Standard.

A T_SalesData table in Excel, with rep names in column A, regions in column B, revenues in column C, and units sold in column D.

Here’s how to do this:

  1. Launch the Conditional Column dialog and name your new column Performance Tier.
  2. Fill in the fields for the first condition as follows:

    • Column Name: Revenue
    • Operator: is greater than or equal to
    • Value: 10000
    • Output: Platinum
  3. Click Add Clause and repeat the process for Gold with the operator set to is greater than or equal to and a value of 5000.
  4. In the final Else box, type Standard.
  5. Click OK, and your new conditional column appears on the right of your query.
Graphic featuring Excel and Power Query logos alongside a database and bar charts.


You don’t need VBA to auto-refresh your Power Queries in Excel

Stop relying on manual clicks and clunky code—let Excel refresh your queries automatically.

Use case 2: Clean up messy text strings

Using “contains” to fix inconsistent data

The “contains” operator is a game-changer because it performs a substring match, finding text anywhere within the string.

The scenario: Your Notes column contains inconsistent entries, such as “Late – driver delay,” “Delayed by weather,” and “Client rescheduled.” You want a single column that simply says “Late” if any related keywords appear.

A T_ShippingLog table in Excel with order IDs in column A, customers in column B, notes in column C, and days in transit in column D.

Once you’ve used the Conditional Column tool for the first time, it becomes a straightforward part of your workflow. However, text matching in Power Query can sometimes produce unexpected results if your data isn’t standardized—for example, a value like “delayed” might not always match “Delayed”—which is why there’s an extra normalization step before applying conditions:

  1. Select your Notes column and click Transform > Format > Lowercase.
  2. Open the Conditional Column dialog and name the column Status Group.
  3. For the first condition:

    • Column Name: Notes
    • Operator: contains
    • Value: late (make sure this is lowercase to match your standardized text).
    • Output: Late
  4. Click Add Clause and repeat the steps for the keywords delay and reschedule.
  5. In the Else field, type On Time.
  6. When you click OK, the comments are neatly categorized according to their keywords.
Excel logo with a spreadsheet in the background, some charts around it, and 'Power Query' written.


Clean up messy Excel data fast with fuzzy matching in Power Query

Merge lists even with typos and inconsistent names. Tune the similarity threshold, use a transform table, and audit results before loading.

Use case 3: Build a fail-safe for errors

Using the “Else” field as a data filler

The “Else” state ensures every row receives an output value, making it easy to spot data that doesn’t fit your expected patterns.

The scenario: You categorize items as “Electronics,” “Homeware,” and “Office” based on ID prefixes. You want to ensure new, unplanned categories don’t break your report.

A T_Inventory table in Excel, with product IDs in column A, product names in column B, stock levels in column C, and prices in column D.

Here are the steps:

  1. Add a Conditional Column and name it Category Audit.
  2. First, define your rules for Electronics:

    • Column Name: Product ID
    • Operator: begins with
    • Value: ELEC
    • Output: Electronics
  3. Click Add Clause and repeat the process for Homeware and Office.
  4. For the Else field, type Needs Review so you’re reminded to double-check these IDs and decide what to do with them.
  5. Click OK to see your new categories in action.

You don’t have to live in a world of endless parentheses and broken logic gates. Moving your “if/then” rules into a conditional column makes your data easier to read and much harder to break. Once you see how much faster your workflow becomes, take half an hour to explore other Power Query transformation tools—you’ll probably find that they handle many everyday tasks more efficiently than standard Excel formulas.

OS

Windows, macOS, iPhone, iPad, Android

Free trial

1 month

Microsoft 365 includes access to Office apps like Word, Excel, and PowerPoint on up to five devices, 1 TB of OneDrive storage, and more.




Source link

Leave a Reply

Subscribe to Our Newsletter

Get our latest articles delivered straight to your inbox. No spam, we promise.

Recent Reviews


Do you ever walk past a person on the streets exhibiting mental health issues and wonder what happened to their family? I have a brother—or at least, I used to. I worry about where he is and hope he is safe. He hasn’t taken my call since 2014.

James and his brother as young children playing together before his brother became sick. James is on the right and his brother is on the left.

James and his brother as young children playing together before his brother became sick. James is on the right and his brother is on the left.

When I was 13, I had a very bad day. I was in the back of the car, and what I remember most was the world-crushing sound violently panging off every surface: he was pounding his fists into the steering wheel, and I worried it would break apart. He was screaming at me and my mother, and I remember the web of saliva and tears hanging over his mouth. His eyes were red, and I knew this day would change everything between us. My brother was sick.

Nearly 20 years later, I still have trouble thinking about him. By the time we realized he was mentally ill, he was no longer a minor. The police brought him to a facility for the standard 72-hour hold, where he was diagnosed with paranoid delusional schizophrenia. Concluding he was not a danger to himself or others, they released him.

There was only one problem: at 18, my brother told the facility he was not related to us and that we were imposters. When they let him out, he refused to come home.

My parents sought help and even arranged for medication, but he didn’t take it. Before long, he disappeared.

My brother’s decline and disappearance had nothing to do with the common narratives about drug use or criminal behavior. He was sick. By the time my family discovered his condition, he was already 18 and legally independent from our custody.

The last time he let me visit, I asked about his bed. I remember seeing his dirty mattress on the floor beside broken glass and garbage. I also asked about the laptop my parents had gifted him just a year earlier. He needed the money, he said—and he had maxed out my parents’ credit card.

In secret from my parents, I gave him all the cash I had saved. I just wanted him to be alright.

My parents and I tried texting and calling him; there was no response except the occasional text every few weeks. But weeks turned into months.

Before long, I was graduating from high school. I begged him to come. When I looked in the bleachers, he was nowhere to be seen. I couldn’t help but wonder what I had done wrong.

The last time I heard from him was over the phone in 2014. I tried to tell him about our parents and how much we all missed him. I asked him to be my brother again, but he cut me off, saying he was never my brother. After a pause, he admitted we could be friends. Making the toughest call of my life, I told him he was my brother—and if he ever remembers that, I’ll be there, ready for him to come back.

I’m now 32 years old. I often wonder how different our lives would have been if he had been diagnosed as a minor and received appropriate care. The laws in place do not help families in my situation.

My brother has no social media, and we suspect he traded his phone several years ago. My family has hired private investigators over the years, who have also worked with local police to try to track him down.

One private investigator’s report indicated an artist befriended my brother many years ago. When my mother tried contacting the artist, they said whatever happened between them was best left in the past and declined to respond. My mom had wanted to wish my brother a happy 30th birthday.

My brother grew up in a safe, middle-class home with two parents. He had no history of drug use or criminal record. He loved collecting vintage basketball cards, eating mint chocolate chip ice cream, and listening to Motown music. To my parents, there was no smoking gun indicating he needed help before it was too late.

The next time you think about a person screaming outside on the street, picture their families. We need policies and services that allow families to locate and support their loved ones living with mental illness, and stronger protections to ensure that individuals leaving facilities can transition into stable care. Current laws, including age-based consent rules, the limits of 72-hour holds, and the lack of step-down or supported housing options, leave too many families without resources when a serious diagnosis occurs.

Governments and lawmakers need to do better for people like my brother. As someone who thinks about him every day, I can tell you the burden is too heavy to carry alone.

James Finney-Conlon is a concerned brother and mental health advocate. He can be reached at [email protected].



Source link