Always having the zero balances at the bottom, when sorting by account names, could be done by adding another filter helper column to sort by.
Note that accounts would have a different sort position if a zero account became non-zero (some people always want a fixed order for referencing elsewhere).
There’s two formula changes - add the new filter column, and then update sort to use it.
Google Sheets
OLD:
,Indirect(Y16)},
NEW:
,Indirect(Y16),Indirect(Y16)<>0},
NEW sort (2:Group, 6:non-zero balance, 3:Account):
2, true, 6, false, 3, true
Microsoft Excel
Excel will also need two additional columns inserted before the two Full Account
columns (P and Z), to make room for the helper columns.
OLD:
,Accounts!$J$2#),
NEW:
,Accounts!$J$2#,Accounts!$J$2#<>0),
NEW sort (2:Group, 7:non-zero balance, 3:Account):
{2,7,3},{1,-1,1}