Hi Lars,
Are you sure you are using ADDEBIT and ADCREDIT ? I have not found the results you are describing when using those functions. What I have found is that ALL accounts in the range are totalled regardless of Debits or Credits and the resulting net total, Debit or Credit, is what the function acts on.
On the other hand, the ADDRONLY and ADCRONLY can lead to the results you described. Those functions total ONLY the Debits or Credits in the account range.
Take for example an account range with the following balances: $1,000+ and $600-. ADDEBIT would return $400+ whereas ADCREDIT would return $0 because the net total of the accounts is a Debit. However, on the same range ADDRONLY would return $1,000+ and ADCRONLY would return $600-
Don't know if we could be getting different results due to different versions of Ledger but the above is what I've found with 8.0D (061013).
Pete
BTW Softrak Sample Spec creators - The Sample Spec GL!BankLOC uses ADDRONLY in the Assets and ADCREDIT in the Liabilities. The ADDRONLY works fine in this spec as only a single account is referenced. However, it might be better to use ADDEBIT as this handles both single and multiple account references. When I first started doing that type of spec I ran into the problem Lars indicated since I had copied the formula from the Sample Spec and did not even realise that an ADDEBIT existed and was distinctly different from an ADDRONLY. Might be a help to other lazy (don't read manuals) souls like myself from making the same error :-)