How to calculate custom field value (average)

You can try this to fetch the custom values:

$c1 = get_post_meta( get_the_ID(), 'custom1', TRUE );   
$c2 = get_post_meta( get_the_ID(), 'custom2', TRUE );   
$c3 = get_post_meta( get_the_ID(), 'custom3', TRUE );   
$c4 = get_post_meta( get_the_ID(), 'custom4', TRUE );   

Then to calculate the average:

// check if c1, c2, c3 and c4 are all set:
if( strlen($c1) * strlen($c2) * strlen($c3) * strlen($c4) > 0 ){

    // convert the values from string to int/float:
    $c1 = 1 * $c1;
    $c2 = 1 * $c2;
    $c3 = 1 * $c3;
    $c4 = 1 * $c4;

    // calculate the average:
    $avg = ($c1 + $c2 + $c3 + $c4) / 4 ;

    // output:
    // var_dump($avg);
    printf( "The average is %.2f", $avg );    // with two decimals:


}else{
    echo " missing value! ";
}