# RangeTextCount - 指令碼與圖表函數

RangeTextCount() 會傳回運算式或欄位中文字值的數量。

RangeTextCount(first\_expr[, Expression])

傳回的資料類型： 整數

此函數的引數可包含其本身就會傳回值清單的記錄間函數。

* first\_expr: 包含待測量資料的運算式或欄位。
* Expression: 包含待測量資料範圍的選用運算式或欄位。

範例與結果

| 範例 | 結果 |
| --- | --- |
| `RangeTextCount<br>(1,2,4)` | 傳回 0 |
| `RangeTextCount<br>(5,'abc')` | 傳回 1 |
| `RangeTextCount<br>(null( ))` | 傳回 0 |

範例： (使用運算式)

`RangeTextCount
(Above(MaxString(MyField),0,3))`

傳回 MaxString(MyField) 函數針對目前列和目前列上方兩列，所評估的三個結果中文字值的數量。

提示備註停用 MyField 的排序可確保範例按預期運作。

運算式輸出範例

| MyField | MaxString(MyField) | RangeTextCount(Above(Sum(MyField),0,3)) |
| --- | --- | --- |
| 10 | 10 | 0 |
| abc | abc | 1 |
| 8 | 8 | 1 |
| def | def | 2 |
| xyz | xyz | 2 |
| 9 | 9 | 2 |

**範例中使用的資料：**

`RangeTab:` `LOAD * INLINE [` `MyField` `10` `'abc'` `8` `null()` `'xyz'` `9` `] ;`

[TextCount - 圖表函數](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/CounterAggregationFunctions/textcount.htm)