A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
I suspect that Joeu2004 is correct that the contents of the cells are not as simple as you described. I am assuming now that there are formulas in those cells, probably a SUM function that adds up the intervening rows. If that is the case, then Excel doesn't see those cells as blank which is why it is dividing by 6 rather than by 2. You can use this formula to eliminate the cells that don't have a value yet so that Excel will divide by the correct number.
=AVERAGE(FILTER(VSTACK(E7,L7,E24,L24,E31,L31),VSTACK(E7,L7,E24,L24,E31,L31)<>0))
If the formulas in the cells result in "" rather than a 0, change the 0 at the end to "".