XL.ConditionalFormating.AddAboveAverageRule
-------------------------------------------

Adds a conditional formatting rule that highlights cells that are above or below the average for all values in the range.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [14.2](newinversion142.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.ConditionalFormating.AddAboveAverageRule"; BookRef; ConditionalFormattingRef; ConditionalFormatRef { ; aboveAverage; equalAverage; stdDev; StopIfTrue } ) 

**MBS**( **"XL.ConditionalFormating.AddAboveAverageRule";** /\* Adds a conditional formatting rule that highlights cells that are above or below the average for all values in the range. \*/  
**$BookRef**; /\* The reference number for the workbook.e.g. $ref \*/   
**$ConditionalFormattingRef**; /\* The reference number for the conditional formatting.e.g. $ConditionalFormatting \*/   
**$ConditionalFormatRef**; /\* The reference number for the conditional format.  
The conditional format used for highlighting cells, use the [XL.Book.AddConditionalFormat](XLBookAddConditionalFormat.md) for adding conditional formats.e.g. $ConditionalFormat \*/   
**$aboveAverage**; /\* Optional; True for \[above average\] rule, false for \[below average\] rule.  
Default is true. \*/   
**$equalAverage**; /\* Optional; True for inclusive of the average itself, false for exclusive of that value, valid only for \[above average\] rule.  
Default is false. \*/   
**$stdDev**; /\* Optional; The number of standard deviations to include above or below the average, valid only for \[above average\] rule. \*/   
**$StopIfTrue**) /\* Optional; If true, no rules with lower priority may be applied over this rule, when this rule is true. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| BookRef | The reference number for the workbook. | $ref |  |
| ConditionalFormattingRef | The reference number for the conditional formatting. | $ConditionalFormatting |  |
| ConditionalFormatRef | The reference number for the conditional format.   The conditional format used for highlighting cells, use the [XL.Book.AddConditionalFormat](XLBookAddConditionalFormat.md) for adding conditional formats. | $ConditionalFormat |  |
| aboveAverage | True for \[above average\] rule, false for \[below average\] rule.   Default is true. |  | Optional |
| equalAverage | True for inclusive of the average itself, false for exclusive of that value, valid only for \[above average\] rule.   Default is false. |  | Optional |
| stdDev | The number of standard deviations to include above or below the average, valid only for \[above average\] rule. |  | Optional |
| StopIfTrue | If true, no rules with lower priority may be applied over this rule, when this rule is true. |  | Optional |

### Result

Returns OK or error.

### Description

Adds a conditional formatting rule that highlights cells that are above or below the average for all values in the range.  
### See also

- [XL.Book.AddConditionalFormat](XLBookAddConditionalFormat.md)
- [XL.ConditionalFormating.Add2ColorScaleRule](XLConditionalFormatingAdd2ColorScaleRule.md)
- [XL.ConditionalFormating.Add3ColorScaleRule](XLConditionalFormatingAdd3ColorScaleRule.md)
- [XL.ConditionalFormating.AddTimePeriodRule](XLConditionalFormatingAddTimePeriodRule.md)

Created 30th March 2024 , last changed 31st March 2024

  
[XL.ConditionalFormating.Add3ColorScaleRule](XLConditionalFormatingAdd3ColorScaleRule.md) - [XL.ConditionalFormating.AddOpNumRule](XLConditionalFormatingAddOpNumRule.md)

[HTML Version](XLConditionalFormatingAddAboveAverageRule.shtml)