Formatting Issues

How to Automatically Format Excel Codes with Colors using Conditional Formatting

Algirdas JasaitisAlgirdas Jasaitis Nov 10, 2026 869 views

Question details

The user wants to automatically apply specific fill colors to worksheet cells when specific text codes, such as PM, are entered.

How to Automatically Format Excel Codes with Colors
Product
Excel
Device & OS
not provided
Scenario
Data entry and spreadsheet organization where visual color-coding is required based on specific text input.
Observed behavior
Cells need to automatically change background or text color immediately after a specified code is typed into them.
Before you start

Ensure you know exactly which text codes you will use and the specific colors you want to assign to each code. It is best to highlight the entire range of cells you plan to apply these rules to before starting the process.

Solution 1Recommended

Use Conditional Formatting with a Text Rule

This is the simplest method for applying a specific color to a cell when it contains a single text code like 'PM'.

By using the built-in Highlight Cells Rules, you can quickly instruct your spreadsheet to look for specific text strings and apply a background color or font color automatically.

1
Select the target range

Click and drag to highlight the range of cells where you want the color formatting to apply when you type your codes.

2
Open Conditional Formatting

Navigate to the 'Home' tab on the ribbon, click on the 'Conditional Formatting' button, and hover over 'Highlight Cells Rules'.

3
Set the text condition

Choose 'Equal To' or 'Text that Contains'. In the dialog box that appears, type your specific text code (for example, type PM).

4
Choose your color format

Select a pre-defined color combination from the drop-down menu, or click 'Custom Format' to choose a specific fill color, then click 'OK'.

Use Conditional Formatting with a Text Rule
Formatting Applied: Your selected cells will now automatically change color whenever the specified text code is entered.

Color Code Your Data Easily in WPS Spreadsheet

WPS Spreadsheet offers powerful and intuitive Conditional Formatting tools that let you easily color-code your data based on specific text or numeric criteria.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the document where you want to apply your color codes.
  2. 2. Select the cells: Click and drag to highlight the specific cells, rows, or columns you want to format.
  3. 3. Access Conditional Formatting: Go to the Home tab and click on the 'Conditional Formatting' icon.
  4. 4. Set the text rule: Select 'Highlight Cells Rules' > 'Text that Contains', type your code, pick a custom color, and hit 'OK'.
Fully compatible with Microsoft Excel conditional formatting rules and formulas.Intuitive and easy-to-use interface for managing multiple color-coding rules.Lightweight and runs smoothly even with large datasets and complex conditional logic.Free alternative with familiar ribbon menus so you can start working immediately.
microsoft office alternative - wps office

Frequently Asked Questions

Can I apply conditional formatting to an entire row based on one cell's text code?

Yes. Select the entire row or dataset, go to Conditional Formatting > New Rule, choose 'Use a formula to determine which cells to format', and enter a formula with an absolute column reference, such as =$A1="PM". Then apply your desired fill color format.

How do I remove conditional formatting rules from my cells?

To clear formatting, select the affected cells, go to 'Home' > 'Conditional Formatting' > 'Clear Rules', and choose either 'Clear Rules from Selected Cells' or 'Clear Rules from Entire Sheet'.

Is there a limit to how many conditional formatting rules I can add for different text codes?

While modern spreadsheet software supports up to 64 conditional formatting rules per cell, having too many rules can slow down workbook performance. For more than 10-15 distinct codes, consider using VBA or setting up a dynamic Lookup table instead.

Why isn't my conditional formatting color updating automatically when I type a code?

Ensure that your workbook calculation options are set to 'Automatic' rather than 'Manual'. Go to the Formulas tab on your ribbon and check your Calculation Options. Additionally, check if there are leading or trailing spaces in the cell you are typing into, which might make it mismatch the exact text rule.