Hi Martin, unless you're really good with JS, this is likely the easiest way to do this
In your Payroll Team create 2 Roles "RoleAL" and "RoleMZ"
On the form create a field called RolebyLetter (you can change the variable name if so choose). The field variable name will be used below.
In the RolebyLetter field use this formula
=IF(FIND(LEFT(LastName,1),"abcdefghijklABCDEFGHIJKLmnopqrstuvwxyzMNOPQRSTUVWXYZ",1)<25,"RoleAL","RoleMZ")
This will return the Role to be selected based on where the Left char of the last name is found in the string, I have to have both upper and lower characters in the string as Find is case dependent.
In the dynamic Filter, create the following Filter to use with your Payroll Teams Task Assignment
$result=team.findMembersByRole($util.getValue('RolebyLetter'));
It should now route the task to the employee assigned to the RoleAL or RoleMZ Roles based on the first letter of the Last Name
Hope this helps