For this kind of requirement, normally, there are 2 ways, but all need some effort with figuring out the logic behind:
1. As Daniel mentioned, you can create an "expression filter" in nprinting to get all the names you want.
2. You can create a new column using the logic in the .qvw file to group the names.
For me, I prefer to use the second way, as it is much easier to process this in Qlikview, and also because the "expression filter" in Nprinting can be tricky.