# RangeTextCount - script and chart function

RangeTextCount() returns the number of text values in an expression or field.

Syntax:

RangeTextCount(first\_expr[, Expression])

Return data type: integer

Arguments:

The arguments of this function may contain inter-record functions which in themselves return a list of values.

Argument

| Argument | Description |
| --- | --- |
| first\_expr | The expression or field containing the data to be measured. |
| Expression | Optional expressions or fields containing the range of data to be measured. |

Examples and results:

Function examples

| Examples | Results |
| --- | --- |
| `RangeTextCount<br>(1,2,4)` | Returns 0 |
| `RangeTextCount<br>(5,'abc')` | Returns 1 |
| `RangeTextCount<br>(null( ))` | Returns 0 |

Example with expression:

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

Returns the number of text values within the three results of the MaxString(MyField) function evaluated over the current row and two rows above the current row.

Data used in examples:

Tip noteDisable sorting of MyField to ensure that the example works as expected.

Example data

| 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 |

Data used in examples:

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

## Learn more

* [TextCount - chart function](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/CounterAggregationFunctions/textcount.htm)