# Variable conditional formatting rules

Variable Conditional Formatting is a feature that allows you to apply conditional formatting rules to elements that are not directly linked to specific data points. This can include altering the line color, specific parts of your title, x-axis, and y-axis titles. By using variables, you can combine multiple rules and apply them together, enabling more advanced formatting on non-data elements.

With variables, you can reuse the same conditional formatting rules and apply them to different elements. Let's see how.

**STEP 1:** Define the conditional formatting rule and select the color to be applied when the condition is met. Remember to enable the **Use as variable** toggle.

<figure><img src="/files/3nNDw015tUcDcogPXc77" alt=""><figcaption><p>Define the conditional formatting variable</p></figcaption></figure>

**STEP 2:** You can combine multiple conditions with variables. For example,  if sales > average sales, set the color to red; if sales < average sales, set the color to green. When you combine conditions, ensure that all the rules have the same variable ID.

<figure><img src="/files/UFKfrCoJCZhRDEDrmrP8" alt=""><figcaption><p>Use the same variable ID to combine multiple CF rules</p></figcaption></figure>

**STEP 3:** To use the variable to change the font color of the x-axis title, open title settings > color picker. Navigate to the CF Rules tab and select the variable to apply.

<figure><img src="/files/GZZEjaUmXUympwE6VcLK" alt=""><figcaption><p>Using variables to change the x-axis title color</p></figcaption></figure>

**STEP 4:**  Use variables to drive the color of the header. Just like we did for the x-axis title, select the variable from the CF Rules tab of the color picker.

<figure><img src="/files/Gu4ta7nGWW5eWi77Bico" alt=""><figcaption><p>Using variables to apply conditional formatting to the header</p></figcaption></figure>

**STEP 5:** Change the color of line charts with conditional formatting the same way - select the variable from the **Category format** color picker in Canvas settings.

<figure><img src="/files/7RuFxEcMOHcFqbzJCh7g" alt=""><figcaption><p>Using conditional formatting variables to change the color of line charts</p></figcaption></figure>

Watch the variable rules in action when we switch between data from different years:

<figure><img src="/files/y9IrjAPQnSvVtznyK3Z3" alt=""><figcaption><p>CF rules for variables</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inforiver.com/analytics+/working-with-analytics+/9.-conditional-formatting/configuring-rules/variable-conditional-formatting-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
