Forum Discussion

Fraser S's avatar
Fraser S
Copper Contributor
Jun 30, 2018

Help needed - basic question i think: I'm trying to create a formula for averages...

Sounds easy enough but the number of numbers varies e.g.

 

1.68, 1.70, 2.68, 1.78 divided by the number of columns i.e 4, so 7.84 (total of the numbers) / 4 - the amount of columns

The next row though may only have two numbers so 1.88, 2.60, so this formula would be divided by 2.

 

Other than manually adjusting each formula is there a way for excel to know it's dividing the total of the numbers by the number of numbers/columns within the calculation?

3 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Hi Fraser,

     

    If your other cells are empty when like

    =SUM(A1:I1)/COUNTA(A1:I1)

     

    • Detlef_Lewin's avatar
      Detlef_Lewin
      Silver Contributor

      Or simply:

      =AVERAGE(A1:I1)

      AVERAGE() ignores text and empty cells.

       

    • Fraser S's avatar
      Fraser S
      Copper Contributor
      Thanks, that works a treat...