really simple.
in the formula:
shared numbervar aVar;
done, that is all that is needed to create/access a shared variable.
Other things to know. := assigns to the variable, while = checks if they are the same.
Typically, formulas for this sort of operation come in groups of 3.
1) to reset to 0 (usually in the groupheader)
2) to increment (usually in details)
3) to display the results (usually in group footer)
That is pretty much it, rest of formula is the same.
HTH