# GetExcludedCount

GetExcludedCount() finds the number of excluded distinct values in the identified field. Only excluded (gray cell with white text) values are counted. Alternative (white cell with gray text) and selected excluded (gray cell with green text) values are not counted.

Syntax:

GetExcludedCount (field\_name)

Return data type: string

Arguments:

* field\_name: The field containing the range of data to be measured.

The following table lists other functions that are related to this function.

Related functions

| Function | Interaction |
| --- | --- |
| [GetStateCounts](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getstatecounts.htm) | Using GetStateCounts(), you can combine the calculation of the following counts using a single function call:<br><br><ul> <li> <p>Count of selected included values.</p> </li> <li> <p>Count of possible values.</p> </li> <li> <p>Count of deselected values (only available if the field is in and-mode).</p> </li> <li> <p>Count of alternative values.</p> </li> <li> <p>Count of excluded values, not including alternative and selected excluded values.</p> </li> <li> <p>Count of selected excluded values.</p> </li> </ul> |
| [GetSelectedCount](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getselectedcount.htm) | Returns the count of selected included values. |
| [GetPossibleCount](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getpossiblecount.htm) | Returns the count of possible values. |
| [GetNotSelectedCount](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/GetNotSelectedCount.htm) | Returns the count of deselected values (only available if the field is in and-mode). |
| [GetAlternativeCount](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getalternativecount.htm) | Returns the count of alternative values. |

## Color of selection states in List Boxes

All information on this page refers to the color of selection states in a List Box with specific settings:

* The QlikView document configured to a Color Scheme of Classic Extended. See: [Selection Appearance](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Document_Properties_General.htm#SelectionAppearance)

* List Box configured with Show Alternatives turned on. See: [Show Alternatives](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/List_Box.htm#ShowAlternatives)

The following table outlines the color scheme for each selection state in a List Box with this configuration.

Color scheme for List box with given configuration

| State | Cell color | Text color |
| --- | --- | --- |
| Alternative | White | Gray |
| Deselected | Red | Black |
| Excluded | Gray | White |
| Possible | White | Black |
| Selected | Green | Black |
| Selected excluded | Gray | Green |

## Examples

The following example uses three fields loaded to different listboxes: one for First name, one for Last name, and one for Initials.

Example 1: no values selected in First name

`GetExcludedCount  (Initials)`

Returns 0. There are no selections.

Example 2: John selected in First name

`GetExcludedCount  (Initials)`

Returns 5. There are 5 excluded values in Initials with gray color. The JA value will be white as it is associated with the selection John in First name.

Example 3: John and Peter selected in First name

`GetExcludedCount  (Initials)`

Returns 3. John is associated with 1 value and Peter is associated with 2 values, in Initials.

Example 4: John and Peter selected in First name, Franc selected in Last name

`GetExcludedCount ([First name])`

Returns 3. There are 3 excluded values in First name with gray color. GetExcludedCount() only counts excluded values. Alternative and selected excluded values are not included in the count.

Example 5: John and Peter selected in First name, Franc and Anderson selected in Last name

`GetExcludedCount  (Initials)`

Returns 4. There are 4 excluded values in Initials with gray color. The other two values (JA and PF) will be white or light yellow as they are associated with the selections John and Peter in First name.

Example 6: John and Peter selected in First name, Franc and Anderson selected in Last name

`GetExcludedCount  ([Last name])`

Returns 3. There are 3 excluded values in Last name: Brown, Carr, and Elliot. The value Devonshire is an alternative value so it is not included in the count.

Data used in example:

`Names:` `LOAD * inline [` `"First name"|"Last name"|Initials|"Has cellphone"` `John|Anderson|JA|Yes` `Sue|Brown|SB|Yes` `Mark|Carr|MC |No` `Peter|Devonshire|PD|No` `Jane|Elliot|JE|Yes` `Peter|Franc|PF|Yes ] (delimiter is '|');`