Sum and count of custom field values

Thanks for your help guys. They didn’t quit work exactly, but I managed to get the result I needed by doing the following

$reviewsNum = 0;
$reviewsCount = 0;  
$argsSchema = array( 'post_type' => 'reviews', 'posts_per_page' => -1 );
$loopSchema = new WP_Query( $argsSchema );
$count_reviews = wp_count_posts( 'reviews' )->publish;
while ( $loopSchema->have_posts() ) : $loopSchema->the_post();
    $reviewrating       =   get_post_meta(get_the_ID(), "_reviewrating", true);
    if (!empty($reviewrating)){
        $reviewsNum += $reviewrating;
    }
endwhile;
$averagerating = $reviewsNum / $count_reviews;

tech