I don't believe that there is a way to automatically sort by last name, as it's very difficult to determine what is a person's name and what is a band name that shouldn't be swapped around.
It's a bit complex to set up initially, but once it's done, should work as you expect.
This post by glynor includes a nice suggestion which should help make things a lot easier.
I have included it in this guide and modified the expression slightly, so that it applies to
[Album Artist (auto)] rather than
[Artist] 1. Go to:
Tools → Options → Library & Folders → Manage Library Fields…2. Add a new field called
AA Name Swap3. Set the field type to "Calculated Data"
4. Right-click the "Expression" box and open the Expression Editor.
5. Paste the following code:
if(!regex([Album Artist (auto)], /#^([^,]+)\s+([^,]*?)$#/),
[Album Artist (auto)],
regex(listclean([Album Artist (auto)], 2, / ),
/#^(?:(I+|[JS]r\.?)\s+)?(\S+)(.*)$#/, -1)[R2]/,/ listclean([R3], 2, / )[R1]
)
6. Now add another field, which I called
Artist Sort. You don't need to change any of the options for this field.
7. And now we have to add a third and final field, the one which is used to group and sort your albums. In my example I call it
_Artist Sort Header8. This is another expression field, using this code:
<font size="10" alpha="0" color="ffffff">FirstNotEmpty([Artist Sort], [Album Artist (auto)])<//font>Delimit([Year], /]/ , /[)[Album]Delimit([Album Artist (auto)],,/ by/ )
9. Now that all our fields have been created, you can return to viewing your library. In your views, you will have to click the downward pointing arrow and select:
Group By → More (sort groups a-z) → _Artist Sort Header10. For any album that you wish to have sorted by last name, select it and open the tagging pane. (right-click and select "tag" or hit
ALT+ENTER on the keyboard)
11. In the tagging pane, select the "Artist Sort" field and enter:
=[AA Name Swap] And that should be it. I know that it's a bit complex, but after that initial setup, it should be easy to use.
The "Artist Sort" field can also be manually edited if
=[AA Name Swap] doesn't give you the correct results, but it should most of the time.