Search code examples
if-statementgoogle-sheetsgoogle-sheets-formulaaveragerounding

#N/A error stating only 1 argument, but IF formula seems to be set up correctly?


Formula causing error:

=IF(ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2)="",0,ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2))))

The goal is to survey the columns listed for Row 2, which themselves subtract two dates to get the days between the two. As some of these dates are empty (it's a huge data range) I had to build in an argument to show a blank so as not to skew the average output.

The problem is the cell is showing #N/A:

Wrong number of arguments to IF. Expected between 2 and 3 arguments, but got 1 arguments.


Solution

  • try:

    =IF(ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2))="",0,
        ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2)))
    

    or:

    =IF(IFERROR(ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2)))="",0,
                ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2)))
    

    or:

    =IFERROR(ROUND(AVERAGE($I2,$L2,$O2,$R2,$V2,$X2,$V2)), 0)