Listing your GnuCash accounts in the order you want to see them
As I was writing my GnuCash tip about using the hidden account feature to tuck your closed out stock positions away until you need them later, I realized I had accumulated a good number of closed positions this year already. The list had gotten fairly long. The first thing I wanted to do was what 90% of us want to do when we encounter a long list. I wanted to sort it.
Sorting in GnuCash is accomplished by the most intuitive means we've all come to understand well. Just click on the column heading and your list will be sorted by whatever field that column heading represents.
Well that was pretty simple, and it solves a great number of sorting situations. But what if the field you want to sort on isn't available? If you don't see the field you need to sort on then you need to add that field to your GnuCash Accounts Tree view. Do you see the arrow pointing down in the upper right corner of the GnuCash Accounts Tree window? It's all the way to the right of the last column header. Click it. When you do you get a list of all available account fields GnuCash can display. Toggle on/off whichever fields you want. Then you can sort on that field selection too.
But what if you want to see your GnuCash accounts sorted in a different way? What if you want them sorted in your own arbitrary way? For example, what if you have two checking accounts - one called simply "Checking Account" and the other called "Main Checking Account" - and you wanted the Main Checking Account displayed first? You could sort them inverse alphabetically, but that might not be logical for other accounts in your GnuCash Account Tree.
The key to solving this problem lies in giving your accounts codes. Click on any account and then select Edit -> Edit Account. The second text field in the Account Edit dialog box is called Account Code. You can give your accounts any coding scheme you want.
Here I've assigned my Assets, Liabilities, Income, Expenses and Equity accounts code numbers 001 through 005. I've further assigned account codes C1 and C2 to my Main Checking and Checking accounts. Now, by adding the Account Code field to the GnuCash Accounts Tree screen I can simply click on that field and see my accounts sorted the way I like. If I decide I want to sort them in another way later on, all I have to do is reorder the account codes.
