Formatting Issues

Apply Roster Colors from a Legend in WPS Spreadsheets Using Conditional Formatting

Olivia MillerOlivia Miller Nov 13, 2026 869 views

Question details

The user needs to apply fill colors to attendance roster cells based on shift and leave codes such as D, SL, and T, using a separate legend that maps each code to a color.

Apply Roster Colors from a Legend in WPS Spreadsheets Using Conditional Formatting
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
Formatting a staff attendance roster so each cell automatically changes color according to the attendance code entered.
Observed behavior
Cells should display the matching legend color for each code while keeping the roster values unchanged.
Before you start

Make sure the roster and the legend are in the same workbook, and identify the top-left cell of the roster range, for example A2, and the legend range, for example Legend!A2:B10.

Solution 1Recommended

Create a VLOOKUP-based conditional formatting rule for each roster code

Use this when the legend may change or when you want each attendance code to inherit the exact color mapped in a separate legend range.

WPS Spreadsheets evaluates conditional formatting formulas relative to the active cell. When you select the full roster, use the top-left cell such as A2 in the formula so the rule adjusts correctly for every selected cell.

1
Select the attendance roster range

Open your attendance workbook in WPS Spreadsheets and select the entire roster area where codes will be entered, for example A2:G50.

2
Open conditional formatting

Go to the Home tab and click Conditional Formatting > New Rule.

3
Choose a formula-based rule

In the New Formatting Rule dialog, select Use a formula to determine which cells to format.

4
Enter the lookup formula for the code

In the formula box, enter =VLOOKUP(A2,Legend!$A$2:$B$10,2,FALSE)="D". Replace A2 with the top-left cell of your selection and Legend!$A$2:$B$10 with your actual legend range.

5
Set the fill color

Click Format, open the Fill or Background tab, choose the color that matches the legend for code D, and confirm with OK.

6
Repeat for other codes

Create another rule for each additional code, such as SL and T, by changing the final text in the formula to "SL" or "T" and assigning the corresponding color.

Create a VLOOKUP-based conditional formatting rule for each roster code
Rule works across the roster: Because the formula uses a relative reference for A2 and absolute references for the legend, WPS Spreadsheets adjusts the lookup for each cell in the selected range.
Direct solution in WPS Spreadsheets

Color Roster Cells from a Legend with WPS Spreadsheets Conditional Formatting

Use WPS Spreadsheets to create formula-based conditional formatting rules that read attendance codes from your roster and apply the matching legend color automatically. You can set up D, SL, and T rules in a few steps, and the workbook stays compatible with Excel.

  1. 1. Download and open WPS Office: Download WPS Office for your device, install it, and open your attendance roster workbook in WPS Spreadsheets.
  2. 2. Select the roster area: Highlight the range where attendance codes will be entered, for example A2:G50.
  3. 3. Create a legend-driven rule: On the Home tab, select Conditional Formatting > New Rule > Use a formula to determine which cells to format.
  4. 4. Enter and format the code formula: Use =VLOOKUP(A2,Legend!$A$2:$B$10,2,FALSE)="D" and choose the legend color for D, then repeat for SL and T.
  5. 5. Save the workbook: Save the file as .xlsx to keep the conditional formatting rules and maintain Excel compatibility.
Supports VLOOKUP-based conditional formatting, so legend changes are reflected automatically.Lets you color-code attendance rosters without changing cell values.Opens and saves .xlsx and .xls files for smooth Microsoft Excel compatibility.Free, lightweight interface with familiar conditional formatting menus.
microsoft office alternative - wps office

Frequently Asked Questions

Can the legend be stored on a different sheet?

Yes. Reference the sheet in the rule formula, such as Legend!$A$2:$B$10. WPS Spreadsheets will read the legend values from that sheet.

Why use A2 in the formula if my roster contains many columns?

When you select the whole roster, the conditional formatting formula is relative to the top-left cell of the selection. Use that cell reference so WPS adjusts the lookup correctly across rows and columns.

How do I stop the roster values from being replaced by colors?

Conditional formatting only changes the cell appearance, not the cell value. The original attendance code remains in the cell.

How can I change a legend color later?

Open Home > Conditional Formatting > Manage Rules, select the rule for that code, click Edit Rule, and change the format. If the legend mapping changes, update the legend range or formula reference.