1. Execute the below code in Developer Console.
for ( Profile objProfile : [ SELECT Name, ( SELECT Id, IsActive FROM Users ) FROM Profile ORDER BY Name ] ) {
Integer activeCount = 0;
Integer inactiveCount = 0;
for ( User objUser : objProfile.Users ) {
if ( objUser.IsActive )
activeCount += 1;
else
inactiveCount += 1;
}
system.debug( objProfile.Name + ',' + activeCount + ',' + inactiveCount + ',' + ( ( activeCount > 0 || inactiveCount > 0 ) ? 'Have Users' : 'No Users assigned' ) );
}
2. Open the log.
3. Select Debug Only.
4. Press CTRL + A.
5. Paste it in an excel file.
6. Copy only the Debug statements.
7. Paste it in a note pad file.
8. Replace [15]|DEBUG| with blank.
9. Save the file with .csv extension.