Although this topic is old, for those interested in ways of doing something similar, I would recommend one of these approaches:
– Based on the existing functions in the administrative interface, go to your WordPress Dashboard under Users and search for the last name. Mark those users that are appropriate and assign them to the desired groups in bulk as explained on https://docs.itthinx.com/document/groups/memberships/
– For a programmatic solution, fork https://github.com/itthinx/groups-role-registration or use it as the basis to implement a customized solution that adds the user to groups on registration as desired