# @Count (Formula Language)

Calculates the number of text, number, or time-date values in a list. This function always returns a number to indicate the number of entries in the list.

This function is similar to @Elements, except that it returns the number 1 instead of 0, when the value it is evaluating is not a list or is a null string.

Note: This @function is new with Release 6.

@Count( list )

## Parameters

list

Text list, number list, or time-date list.

## Return value

numElements

Number. The number of elements in the list. If the value is not a list or is a null string, @Count(list) returns the number 1.

## Examples

1. This formula returns the value 3 when the stooges field contains the text list: "Moe":"Larry":"Curly":
``@Count(stooges)``
2. This code returns the value 1, even if there are 4 entries under the Kevlar category in the Sails view, when the value of the third column in the view is determined by the simple function, # in View:
``@Count(@DbLookup("";"Server/Name/Notes":"Cost\\Materials.nsf";"Sails";"Kevlar";3))``

This formula returns 1 because the list produced by the # in View simple function is a list of special text, not a standard number list. If @Count were replaced by @Elements, the formula would return 0.

3. This formula returns a list of the largest numbers after performing a pair-wise comparison of the elements in the Asia_total and USA_total fields, which contain number lists representing the monthly sales totals for the year in these two regions:
``````tAsia := @Count(Asia_total);
tUSA := @Count(USA_total);
dif := (tAsia - tUSA);
result := @If(@Sign(dif) = -1;@Subset(USA_total;tUSA=@Abs(dif));
@Subset(Asia_total;(tAsia - dif)));
@If(@Sign(dif) = -1;@Max(Asia_total;result);@Max(result;USA_total))``````

If the USA has not yet posted its fourth quarter sales totals, this formula displays only the results of comparing the figures posted for the first nine months. It does not follow the default behavior of repeating the September sales figure three times to even out the two list lengths.