Help with formatting iferror attached to formulas

Hodge
Hodge
edited 03/03/25 in Formulas and Functions

Hello,

I am struggling with something that I think is relatively simple. I am trying to use IFERROR statements if a student is exempt from an entry on any of cells D19 to G19. If it is Exempt it places a zero in H19.

I will not always have numbers in all categories, used IFERROR in conjunction with if statements. y problem lies in if I eliminate the number in D17, it kills the whole formula (second picture). This is not the case for E17 through G17, only D19. I am wondering if I am not attaching the first part of IFERROR statements incorrectly.

Here is the formula, any help or tips would be welcomed.

=IFERROR(if(or(D19="E",E19="E",F19="E",G19="E"),"E",IFERROR(if($D$17="","",D19/$D$17)(COUNTIF($D$17,">=1")/(COUNTIF($D$17:$G$17,">=1"))+IFERROR(if($E$17="","",$E19/$E$17)(COUNTIF($D$17,">=1"))/(COUNTIF($D$17:$G$17,">=1"))+IFERROR(if($F$17="","",$F19/$F$17)(COUNTIF($D$17,">=1"))/(COUNTIF($D$17:$G$17,">=1"))+IFERROR(if($G$17="","",$G19/$G$17)(COUNTIF($D$17,">=1"))/(COUNTIF($D$17:$G$17,">=1"))))))))

Answers

  • The formula might be missing some commas or parentheses, which could be throwing things off. IFERROR is just for catching errors but here it seems like it's being used to check conditions. Might be worth tweaking the structure a bit to make sure it's doing what it's supposed to.

    Try this version:

    =IF(OR(D19="E", E19="E", F19="E", G19="E"), "E",
    IFERROR(IF($D$17="", "", D19/$D$17 * (COUNTIF($D$17, ">=1") / COUNTIF($D$17:$G$17, ">=1"))), 0) +
    IFERROR(IF($E$17="", "", E19/$E$17 * (COUNTIF($E$17, ">=1") / COUNTIF($D$17:$G$17, ">=1"))), 0) +
    IFERROR(IF($F$17="", "", F19/$F$17 * (COUNTIF($F$17, ">=1") / COUNTIF($D$17:$G$17, ">=1"))), 0) +
    IFERROR(IF($G$17="", "", G19/$G$17 * (COUNTIF($G$17, ">=1") / COUNTIF($D$17:$G$17, ">=1"))), 0))
    

    This formula first checks if any of the cells D19 to G19 contain 'E'. If so, it returns 'E'. Otherwise it calculates the weighted sum of the ratios so handles any errors by returning 0.

    Make sure the data in cells d17 to g17 is numeric and that there are no errors in those cells as they might affect the formula's outcome.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!