How to Use Conditional Formatting with XLOOKUP Formula in Excel (2021) Without VBA

Abstract: Apply dynamic conditional formatting in Excel based on XLOOKUP results without using VBA macros.

Created: 2026-09-01 by
You can apply conditional formatting with XLOOKUP in Excel by creating a custom rule that references the formula directly. This method allows dynamic color changes based on lookup results without using VBA macros. The process involves navigating to the Conditional Formatting menu, selecting New Rule, and entering an XLOOKUP-based logical test to evaluate cell values against specific criteria.

Prerequisites and Compatibility

Before implementing this technique, ensure your version of Excel supports the XLOOKUP function. This feature was introduced in Microsoft 365 and Excel 2021. If you are using an older version such as Excel 2019 or earlier, XLOOKUP will not be available, and you must use Resolving '#NAME' Error in XLOOKUP alternatives like VLOOKUP or INDEX/MATCH. Additionally, verify that your data ranges are properly defined. It is best practice to convert your source data into an Excel Table. This ensures that when new rows are added, the range automatically expands, keeping your conditional formatting rules accurate without manual adjustment.

Setting Up the Data Structure

To effectively use XLOOKUP within conditional formatting, you need two distinct areas in your worksheet: the lookup table and the target range. The lookup table contains the reference data, while the target range consists of the cells where you want the formatting to appear. For example, if you are tracking inventory, your lookup table might contain product IDs and their current stock levels. The target range would be the column displaying these IDs in your main dashboard. Ensure that the return array in your XLOOKUP formula matches the data type of the cells being formatted. Mixing text and numbers can lead to unexpected behavior in logical tests.

Creating the Conditional Formatting Rule

Select the range of cells where you wish to apply the formatting. Navigate to the Home tab on the ribbon, click on Conditional Formatting, and choose New Rule. In the dialog box that appears, select "Use a formula to determine which cells to format." This option is crucial because it allows you to enter complex logic rather than simple value comparisons. Enter your XLOOKUP formula in the formula bar. The formula should return a Boolean value (TRUE or FALSE) for each cell in the selected range. For instance, if you want to highlight cells where the lookup result exceeds a threshold, your formula might look like =XLOOKUP(A2, $D$2:$D$100, $E$2:$E$100) > 50. Adjust the cell references to match your specific dataset structure.

Configuring the Format

Once the formula is entered, click the Format button to define the visual appearance. You can choose fill colors, font styles, borders, or number formats. Select a background color that contrasts well with your data to ensure readability. Click OK to save the format settings and OK again to close the rule manager. The cells that satisfy the condition defined by your XLOOKUP formula will immediately change appearance. If no cells change color, double-check the formula syntax and ensure that the ranges are correctly referenced. Relative references in the formula allow the rule to evaluate each row independently, which is essential for dynamic formatting across multiple rows.

Troubleshooting Common Issues

Users often encounter errors when first implementing this setup. If you see a #NAME! error, it indicates that your Excel version does not support XLOOKUP. In this case, refer to resources on Resolving '#NAME' Error in XLOOKUP to switch to compatible functions. Another common issue is the #N/A error, which occurs when the lookup value is not found. To handle this, wrap your XLOOKUP in an IFERROR function, such as =IFERROR(XLOOKUP(...), FALSE). This ensures that missing data returns FALSE, preventing the conditional formatting from breaking or highlighting incorrectly. Additionally, ensure that you are using absolute references ($) for the lookup and return arrays to prevent them from shifting when the rule applies to different rows.

Advanced Applications

This technique can be extended to create more complex dashboards. You can combine XLOOKUP with other functions like ISNUMBER or TEXT to create nuanced formatting rules. For example, you might highlight cells where the lookup result is a specific status code. You can also apply multiple rules to the same range, allowing for layered formatting based on different lookup outcomes. Remember that conditional formatting rules are evaluated in order, so prioritize the most important conditions at the top of the list. This approach provides a powerful, non-VBA way to visualize data trends and anomalies dynamically.

Frequently Asked Questions

Can I use XLOOKUP with VLOOKUP in the same rule?

Yes, you can nest VLOOKUP inside XLOOKUP or vice versa if needed, though it is rarely necessary. Typically, one function suffices for most lookup scenarios. Combining them may complicate the formula and reduce performance. Stick to XLOOKUP for its superior flexibility and error handling capabilities.

Why is my conditional formatting not updating after changing data?

Excel usually updates conditional formatting instantly. If it does not, check if calculation mode is set to Manual. Go to Formulas > Calculation Options and select Automatic. Also, ensure that the ranges in your formula are not hardcoded incorrectly. Dynamic named ranges or Excel Tables help maintain accuracy during updates.

How do I remove the XLOOKUP conditional formatting rule?

Go to Conditional Formatting > Manage Rules. Select the rule associated with your XLOOKUP formula and click Delete Rule. This action removes the formatting but keeps the underlying data intact. You can always recreate the rule later if needed.

Is there a performance limit to how many XLOOKUP formulas I can use?

While Excel handles thousands of formulas well, excessive XLOOKUP calls in conditional formatting can slow down workbook recalculation. Limit the number of active rules and simplify formulas where possible. Using structured references with Excel Tables can optimize performance compared to raw cell ranges.

What happens if XLOOKUP returns an error in the rule?

If XLOOKUP returns an error like #N/A, the conditional formatting rule will treat it as FALSE unless handled. Always use IFERROR to catch these cases and return a logical value. This prevents unwanted formatting on cells with missing data and keeps your dashboard clean.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More