# GetExcludedCount

GetExcludedCount() 用來尋找已識別欄位中的已排除相異值的數目。僅計入排除的值 (灰色儲存格與白色文字)。替代值 (白色儲存格與灰色文字) 和選取的排除值 (灰色儲存格與綠色文字) 不計算在內。

語法：

GetExcludedCount (field\_name)

傳回的資料類型： 字串

引數：

* field\_name： 包含待測量資料範圍的欄位。

下表列出了與此函數相關的其他函數。

相關函數

| 函數 | 互動 |
| --- | --- |
| [GetStateCounts](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getstatecounts.htm) | 使用 GetStateCounts()，您可以使用單一函數叫用合併下列計數的計算：<br><br><ul> <li> <p>所選包含值的計數。</p> </li> <li> <p>可能值的計數。</p> </li> <li> <p>已取消選取的值的計數 (僅當欄位處於 and (和) 模式時才可用)。</p> </li> <li> <p>替代值的計數。</p> </li> <li> <p>排除值的計數，不包括替代值和所選的排除值。</p> </li> <li> <p>所選排除值的計數。</p> </li> </ul> |
| [GetSelectedCount](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getselectedcount.htm) | 傳回所選包含值的計數。 |
| [GetPossibleCount](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getpossiblecount.htm) | 傳回可能值的計數。 |
| [GetNotSelectedCount](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/GetNotSelectedCount.htm) | 傳回已取消選取的值的計數 (僅當欄位處於 and (和) 模式時才可用)。 |
| [GetAlternativeCount](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/FieldFunctions/getalternativecount.htm) | 傳回替代值的計數。 |

## 列表框中選取狀態的顏色

本頁所有資訊均指在具有特定設定的列表框中選取狀態的顏色：

* QlikView 文件設定為 Classic Extended 的色彩配置。請參閱： [選項外觀](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Document_Properties_General.htm#SelectionAppearance)

* 設定為開啟顯示替代選項的列表框。請參閱： [顯示替代選項](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/List_Box.htm#ShowAlternatives)

下表概述了具有此設定的列表框中每個選取狀態的色彩配置。

具有給定設定的列表框的色彩配置

| 狀態 | 儲存格色彩 | 文字色彩 |
| --- | --- | --- |
| 替代 | 白色 | 灰色 |
| 已取消選取 | 紅色 | 黑色 |
| 已排除 | 灰色 | 白色 |
| 可能 | 白色 | 黑色 |
| 已選取 | 綠色 | 黑色 |
| 已選取且已排除 | 灰色 | 綠色 |

## 範例

下列範例使用載入到不同列表框的三個欄位：一個用於 First name，一個用於 Last name，以及一個用於 Initials。

範例 1: 未在 First name 中選取任何值

`GetExcludedCount  (Initials)`

傳回 0。沒有選取。

範例 2: 在 First name 中選取了 John

`GetExcludedCount  (Initials)`

傳回 5。Initials 中有 5 個灰色的排除值。JA 值將是白色，因為它與 First name 中的選項 John 相關。

範例 3: 在 First name 中選取了 John 和 Peter

`GetExcludedCount  (Initials)`

傳回 3。在 Initials 中，John 與 1 個值相關，而 Peter 與 2 個值相關。

範例 4: 在 First name 中選取了 John 和 Peter，在 Last name 中選取了 Franc

`GetExcludedCount ([First name])`

傳回 3。First name 中有 3 個灰色的排除值。GetExcludedCount() 只計入排除值。替代和所選排除值不會納入計數。

範例 5: 在 First name 中選取了 John 和 Peter，在 Last name 中選取了 Franc 和 Anderson

`GetExcludedCount  (Initials)`

傳回 4。Initials 中有 4 個灰色的排除值。其他兩個值 (JA 和 PF) 將會是白色或淺黃色，因為這與 First name 中的選項 John 和 Peter 相關聯。

範例 6: 在 First name 中選取了 John 和 Peter，在 Last name 中選取了 Franc 和 Anderson

`GetExcludedCount  ([Last name])`

傳回 3。Last name 中有 3 個排除值：Brown、Carr 和 Elliot。值 Devonshire 是替代值，因此不包括在計數中。

範例中使用的資料：

`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 '|');`