Skip to main content
CCH Software User Documentation

Nz command

Product Help Banner.png


This section explains the Nz command, which may be used within a formula.

Nz Command

The Nz command counts the number of “non-zero” accounts in a range. This means the number of accounts to be printed by a RangeDef command. If both current and comparative balances are being printed you can use the Nz command to count the number of accounts that are nonzero in either the current or comparative year. For instance:

=AP("Nz,ab,0001..0099") counts the number of nonzero accounts in the range 0001..0099 for either the current or comparative year. 
=AP("Nz,ab,[*TOTREV]") counts the number of nonzero accounts in the named range TOTREV for either the current or comparative year. 

The Nz command is useful in conditions that control whether a heading at the start of a group of accounts is printed, or whether the subtotal at the end is printed.


  1. Years to check The first parameter indicates which year balances to count.  “ab” above indicates that accounts with a balance in either the current year or the comparative year should be counted.
  2. Account range This can be either a nominal range or a named range.
    • Nominal ranges can be specified either with or without the [( and )] brackets, e.g. =AP("Nz,ab,0001..0099")  or =AP("Nz,ab,[(0001..0099)]"). Also, pattern matching nominal ranges are permitted, e.g. =AP("Nz,ab,8101~8901").
    • Named ranges are enclosed in "[*" and "]" brackets.
  3. Subaccounts This should be "s" if subaccounts are to be counted, e.g. =AP("Nz,ab,0001..0099,s"). Otherwise only main accounts are counted.
  4. Debit/credit only This should be  "deb" to count only debits and "cred" to count only credits.


If account codes are specified in the range, then both the From and To account must be specified.  Therefore, if you only want to check a single account, say 7010, do not use =AP("Nz,ab,7010"). Instead use =AP("Nz,ab,7010..7010").


  • Was this article helpful?