How to Use Nested IF Logic for Excel RAG Status
Question details
The user needs to evaluate data in columns H and K to output a RAG (Green, Red, Amber) status using a simplified logical formula.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Assigning project health or performance status based on numerical thresholds across multiple data columns.
- Observed behavior
- The user wants a concise formula that outputs the correct text (Green, Red, or Amber) for subsequent conditional formatting, avoiding overly complex AND statements.
Verify the exact numeric thresholds for your Green, Red, and Amber categories and ensure your target columns contain numeric data.
Apply a Streamlined Nested IF Formula
Use a nested IF function to evaluate the primary condition first, relying on the logical sequence to handle the secondary conditions without needing an AND function.
In a nested IF statement, Excel evaluates conditions sequentially. If the first condition is met, it stops and returns the value. If not, it moves to the next. By checking the highest priority threshold first, you can naturally filter the remaining values, simplifying your formula.
Click on the cell where you want the first status to appear, typically in a new column next to your data (e.g., cell L1).
Type the formula =IF(H1>=1,"Green",IF(K1<1,"Red","Amber")) into the formula bar.
Press Enter to execute the formula, then click and drag the fill handle (the small square at the bottom right of the cell) down to apply the formula to the rest of your dataset.
Select the newly calculated column, navigate to Conditional Formatting > Highlight Cells Rules > Text that Contains, and assign green, red, and yellow background colors to the corresponding text outputs.

Manage RAG Statuses Easily with WPS Spreadsheet
WPS Spreadsheet offers complete support for nested IF formulas and conditional formatting, allowing you to build dynamic and visual RAG dashboards effortlessly.
- 1. Open your data file: Launch WPS Spreadsheet and open the document containing your project data.
- 2. Insert the logic formula: Type your nested IF formula into the status column and drag it down to fill the rows.
- 3. Apply color formatting: Go to the Home tab, click on Conditional Formatting, and use the Highlight Cells Rules to match the text outputs with Green, Red, and Yellow colors.

Frequently Asked Questions
How do I add actual colors to the Green, Red, and Amber text?
After generating the text with your nested IF formula, select the column and click the Conditional Formatting button on the Home ribbon. Select 'Highlight Cells Rules' followed by 'Text that Contains', and set specific background colors for Green, Red, and Amber.
Can I include the AND function if my RAG conditions are more complex?
Yes. If your criteria demand that multiple conditions must be met simultaneously for a specific status, you can place an AND function inside your IF statement. For example: =IF(AND(H1>=1, K1>=1), "Green", "Red").
Why is my nested IF formula showing a #NAME? error?
This usually happens if you forget to wrap your output text in double quotation marks. Ensure your formula uses "Green", "Red", and "Amber" so the spreadsheet recognizes them as text strings rather than undefined functions.




