Ahh friend, you don’t need such a hard way! This should do…
<?php
$curauth = get_userdata($row->ID);
$user_link = get_author_posts_url($curauth->ID);
$posts = get_posts(array(
'author' => $curauth->ID,
'cat' => 60, //for single category, 60
'cat' => -60, //for excluding this category
'posts_per_page' => -1,
)
);
$post_count = count($posts);
?>
Remove the commented line as per your requirement. Try and let me know!