Echo number of all users (subscribers, contributors, authors, etc.) whom have posted at least once

Here is one I happen to use myself. The function returns an array consisting of an array of author ID’s, an array of author names and the number of authors.

Place this code in functions.php

/**
 * Return an array of the number of posting authors, and their names and ID's
 */
function get_author_data(){

    global $wpdb;

    /** Create the query and then grab all of the ID's of all authors who have posted at least once */
    $query = $wpdb->prepare('SELECT DISTINCT %1$s.post_author FROM %1$s WHERE %1$s.post_status IN ("publish")', $wpdb->posts);
    $author_ids = $wpdb->get_col($query);
    $authors['ID'] = $author_ids;

    /** Get the name of all of the authors that have posted at least once */
    $authors['name'] = array();
    if(!empty($authors['ID'])) : foreach($authors['ID'] as $author_id) :

            $query = $wpdb->prepare('SELECT %1$s.display_name FROM %1$s WHERE %1$s.ID = %2$s', $wpdb->users, $author_id);
            $authors['name'][] = $wpdb->get_var($query);

        endforeach;
    endif;

    /** Get a count of the number of authors who have posted at least once */
    $authors['count'] = count($authors['ID']);

    return $authors;

}

When you wish to grab the information –

$authors = get_author_data();

And then to output the information that you require –

/** Output all author names */
if(!empty($authors['name'])) : foreach($authors['name'] as $author_nam) :

        print_f('<li>%1$s</li>', $author_name);

    endforeach;
endif;

/** Output a count of authors */
print_f('<p>Number of contributing authors: %1$s</p>', $authors['count']);