Why not just use the Average function, it automatically excludes empty fields from the divisor count. It works with fields within one record or multiple records in a portal. However, a zero (or other number) in the field will count in the divisor.
It only needs to work within individual records, I think I would rather use a calculation field.
It is a calculation, results number.
Average (MilesPerGallonDay1; MilesPerGallonDay2; MilesPerGallonDay3; MilesPerGallonDay4; MilesPerGallonDay5; MilesPerGallonDay6; MilesPerGallonDay7 )
If all 7 fields contain a number it will divide by 7, if only 5 fields have a data in them it will only divide by 5, etc.
Average is the function right above Case in "Show all by name"
Well, I was trying to mark Bumper's answer as the best one, but apparently my screen was still refreshing and chose mine, but Bumper's answer it the best one......