logo
search
Function Problems

How to Use Excel IFS Formula to Return Colors Based on Column Values

Maira MehtabMaira Mehtab Sep 20, 2026 869 views

Question details

The user needs an Excel formula that evaluates letter codes entered in a specific column and outputs corresponding color names for each code.

Product
Excel
Device & OS
not provided
Scenario
Translating predefined letter codes (such as c, n, d, and f) into descriptive text strings (like blue, red, yellow, and green) across multiple rows in a worksheet.
Observed behavior
The user is looking for the correct syntax to use the IFS function with multiple logical tests to display the correct color name for each assigned letter code.
Before you start

Ensure you are using a spreadsheet application that supports the IFS function, such as Microsoft 365, Excel 2019 or later, or WPS Office. If you are using an older version, you may need to use nested IF functions instead.

Solution 1Recommended

Use the IFS Function to Evaluate Multiple Codes

Construct an IFS formula to test multiple conditions in a single, easy-to-read function and drag it down to apply it to the entire column.

The IFS function checks whether one or more conditions are met and returns a value that corresponds to the first TRUE condition. It is an excellent modern alternative to writing complex nested IF statements.

1
Select the target cell

Click on the cell in the first required row where you want the color name to appear (for example, cell D3 next to your code in C3).

2
Enter the IFS formula

Type the formula: =IFS(C3="c","blue", C3="n","red", C3="d","yellow", C3="f","green") into the formula bar and press Enter.

3
Fill the formula down the column

Click on the cell containing your new formula, hover over the bottom-right corner until the cursor turns into a plus sign (the fill handle), and drag it down the column to automatically adjust the formula for each value entered in column C.

Handling Unmatched Values: To prevent an #N/A error when a cell contains a code not listed in the formula or is left blank, you can add a final condition like TRUE, "Unknown" at the end of the formula: =IFS(C3="c","blue", C3="n","red", TRUE, "Unknown").
Advanced Spreadsheet Functions

Use the IFS Function Flawlessly in WPS Spreadsheet

WPS Office fully supports advanced data processing functions like IFS, allowing you to seamlessly handle multiple conditions and evaluate column values without writing complex nested IF statements.

  1. 1. Open your spreadsheet: Launch WPS Office, open your spreadsheet document, and select the cell where the output should appear.
  2. 2. Insert the IFS formula: Enter your IFS formula directly into the formula bar, specifying the cell references and respective text outputs, then press Enter.
  3. 3. Apply to other cells: Use the fill handle at the bottom right corner of the active cell to drag and copy the formula to the remaining rows in your column.
Fully compatible with Microsoft Excel formulas and .xlsx file formats.Built-in support for advanced logical functions including IFS and XLOOKUP.Free and lightweight office suite with an intuitive, familiar interface.Seamless cross-platform migration across Windows, Mac, Linux, iOS, and Android.
microsoft office alternative - wps office

Frequently Asked Questions

What should I do if the IFS function returns an #N/A error?

An #N/A error occurs when none of the specified conditions in the IFS formula are met. To fix this, you can add a catch-all condition at the very end of your formula, using TRUE as the condition and your desired default text as the result (e.g., TRUE, "Not Found").

Is the IFS function available in older versions of Excel?

No, the IFS function was introduced in Office 365 and Excel 2019. If you are using Excel 2016 or older, you must use nested IF functions instead, such as =IF(C3="c","blue", IF(C3="n","red", "Unknown")).

Can I use the IFS function to change the actual background color of a cell?

No, spreadsheet formulas can only return values like text or numbers; they cannot apply formatting. If you want the cell background color to change automatically based on the letter code entered, you must use the 'Conditional Formatting' feature instead.