Formulas and Functions

Formulas and Functions

Ask for help with your formula and find examples of how others use formulas and functions to solve a similar problem.

AVG formula #DIVIDE BY ZERO

Hello, community!

I have a question. I'm using the "IF" formula to calculate a percentage based on the status in the "status" column.

now, I'm trying to calculate the average of those rows, but I get a "#DIVIDE BY ZERO" error when I use the formula AVG.

How can I resolve this?

Tags:

Answers

  • ✭✭✭✭✭✭

    Hi @DG 13

    The #DIVIDE BY ZERO error occurs when your denominator is zero. In this case, if you are trying to calculate the average for the number of items that are not started (for example), it means that no item is set to "Not Started".

    If you know your formula is correct (i.e. it does the math correct everywhere else), you can add an "IFERROR" statement to the front of your entire formula. This will remove the errors (in this case #DEVIDE BY ZERO) and replace it with whatever character/word you choose.

    Here's more information on the IFERROR function:
    https://help.smartsheet.com/function/iferror

    Marcé Holzhauzen
    Solution and Delivery Consultant with Award Winning Partner
    Want to meet?Check my availability

    Find me on:LinkedIn | YouTube

    www.prodactive.co.uk

    If this helped, help me & the SSC by accepting it and reacting w/💡insightful, ⬆️ Vote Up, and/or ❤️Awesome.

  • edited 01/20/25

    Hi @Marce, thanks for replying my post.

    This is the formula IF I used:

    =IF(Status@row = "Not Started", "0%", IF(Status@row = "In Progress", "50%", IF(Status@row = "Completed", "100%", " "))) - To calculate 0%, 50%, and 100%.

    I get the same error when using the AVG function, whether I select all three values or just 50% and 100%.

    I don’t understand why this is happening or how to fix it.


    Thanks in advance for your help!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!

Trending in Formulas and Functions