Countifs not calculating as expected

Options
GetITDone
GetITDone ✭✭
edited 12/09/19 in Smartsheet Basics

Whenever I change a field to NA it should exclude counting it into the average but it is not doing that.  It is staying at 50% but should be 100%. Please let me know what I need to do. See screen shot.

=(SUM(Yes4, Yes6)) / ((COUNT([Department - ie: Sales Eng, TDE's etc]4, [Department - ie: Sales Eng, TDE's etc]6)) - (COUNTIFS(Yes4, "NA", Yes6, "NA")))

 

Thank you.

countif.png

«1

Comments

  • Brian W
    Brian W ✭✭
    edited 02/20/19
    Options

    COUNTIFS is looking for both criteria, not either. I think you need to use COUNT with OR:

    =(SUM(Yes4, Yes6)) / ((COUNT([Department - ie: Sales Eng, TDE's etc]4, [Department - ie: Sales Eng, TDE's etc]6)) - (COUNT(OR(Yes4 = "NA", Yes6 = "NA"))))

  • GetITDone
    Options

    Hi thanks for your suggestion! I just had to tweak   it to look like this in order for it to calculate however

    1. when I select both questions to answer Yes , I get 200% where I only want 100%.  The N/A portion works though.

    =(SUM(Yes4, Yes6)) / ((COUNT([Department - ie: Sales Eng, TDE's etc]4, [Department - ie: Sales Eng, TDE's etc]6) - (COUNT(OR(Yes4 = "NA", Yes6 = "NA")))))  (pic attached)

     

    2. when I select 1 yes and 1 no I need to see 50% whereas the results 100% (pic attached)

     

    I need it to score only on yes and no answers and when NA is selected it makes sure not to average into the equation.

     

    any thought would be great.  This has been very trying.  :-(

    Capture200%.PNG

    Capture 50%.PNG

  • Brian W
    Brian W ✭✭
    Options

    Right. I'm not sure that COUNT/OR combination is even functioning correctly. Rather than doing the whole calculation, could you simply use AVG to average the cells with numbers:

    =AVG(Yes4, Yes6)

    That will average only numbers and ignore NA entries.

  • Brian W
    Brian W ✭✭
    Options

    If you do need to use your original formula, I think you would have to do it this way:

    =(SUM(Yes4, Yes6)) / (COUNT([Department - ie: Sales Eng, TDE's etc]4, [Department - ie: Sales Eng, TDE's etc]6) - (COUNTIF(Yes4, ="NA") + COUNTIF(Yes6, ="NA")))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    You could also try something along the lines of

     

    =SUM(CHILDREN(Yes@row)) / COUNTIFS(CHILDREN(Yes@row), ISNUMBER(@cell))

     

    This will sum the range up (which only looks at numbers anyway), then divide it by how many cells in the range contain a number (leaves out the N/A's).

     

    Using the CHILDREN function also allows the addition or deletion of rows without having to worry about whether or not a range within a formula needs adjusted.

  • GetITDone
    Options

    I like the Children idea however not sure it will work.  I need scored Averages per Department of which there are several in the Department column...so I need to select only those departments ie: Project Management which are shatter through the 300 questions. 

  • GetITDone
    Options

    This might work! I will give this a try now and let you know. Thank you very much

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    edited 02/21/19
    Options

    Ah. Ok. Then this...

    =SUMIFS(Yes:Yes, [Department - ie: Sales Eng, TDE's etc]:[Department - ie: Sales Eng, TDE's etc], "Project Management") / COUNTIFS(Yes:Yes, ISNUMBER(@cell), [Department - ie: Sales Eng, TDE's etc]:[Department - ie: Sales Eng, TDE's etc], "Project Management")

     

    This will look at the entire column and only calculate for those that have the department as Project Management. Just replace the underlined portion with whatever department you are wanting to calculate for.

  • GetITDone
    Options

    This is bizarre.  The first 2 sections work fine with your formula. did not count the NA and scored correctly.

    However for the next larger section, I am getting negative scores whenever I select NA. After changing them all the NA is gave me a -1000%.  Any ideas would be appreciated.  :-)

     

    =SUM(Yes183, Yes206, Yes208, Yes228, Yes229, Yes230, Yes250, Yes252, Yes263, Yes291) / COUNT([Department - ie: Sales Eng, TDE's etc]183, [Department - ie: Sales Eng, TDE's etc]206, [Department - ie: Sales Eng, TDE's etc]208, [Department - ie: Sales Eng, TDE's etc]228, [Department - ie: Sales Eng, TDE's etc]229, [Department - ie: Sales Eng, TDE's etc]230, [Department - ie: Sales Eng, TDE's etc]250, [Department - ie: Sales Eng, TDE's etc]252, [Department - ie: Sales Eng, TDE's etc]263, [Department - ie: Sales Eng, TDE's etc]291) - (COUNTIF(Yes183, ="NA") + (COUNTIF(Yes206, ="NA") + (COUNTIF(Yes208, ="NA") + (COUNTIF(Yes228, ="NA") + (COUNTIF(Yes229, ="NA") + (COUNTIF(Yes230, ="NA") + (COUNTIF(Yes250, ="NA") + (COUNTIF(Yes252, ="NA") + (COUNTIF(Yes263, ="NA") + COUNTIF(Yes291, ="NA"))))))))))

    Rooms.PNG

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    To use the above formula, you will need to wrap the last bit in parenthesis. The basic order of operations is parenthesis, multiplication, division, addition, subtraction. Following this order, you are dividing the sum by the count THEN subtracting the N/A's. Try this formula. Not the added parenthesis after the / and at the end of the formula...

     

    =SUM(Yes183, Yes206, Yes208, Yes228, Yes229, Yes230, Yes250, Yes252, Yes263, Yes291) / (COUNT([Department - ie: Sales Eng, TDE's etc]183, [Department - ie: Sales Eng, TDE's etc]206, [Department - ie: Sales Eng, TDE's etc]208, [Department - ie: Sales Eng, TDE's etc]228, [Department - ie: Sales Eng, TDE's etc]229, [Department - ie: Sales Eng, TDE's etc]230, [Department - ie: Sales Eng, TDE's etc]250, [Department - ie: Sales Eng, TDE's etc]252, [Department - ie: Sales Eng, TDE's etc]263, [Department - ie: Sales Eng, TDE's etc]291) - (COUNTIF(Yes183, ="NA") + (COUNTIF(Yes206, ="NA") + (COUNTIF(Yes208, ="NA") + (COUNTIF(Yes228, ="NA") + (COUNTIF(Yes229, ="NA") + (COUNTIF(Yes230, ="NA") + (COUNTIF(Yes250, ="NA") + (COUNTIF(Yes252, ="NA") + (COUNTIF(Yes263, ="NA") + COUNTIF(Yes291, ="NA")))))))))))

  • GetITDone
    Options

    I copied but got UNPARSEABLE.  :-(

    I need all yes and no answers to be averaged per Installation Process, in this case 'Conference parent... for department "Project Management"

     

     =SUMIFS(Yes:Yes, [Department - ie: Sales Eng, TDE's etc]:[Department - ie: Sales Eng, TDE's etc], "Project Management") / COUNTIFS(Yes:Yes, ISNUMBER(@cell), [Department - ie: Sales Eng, TDE's etc]:[Department - ie: Sales Eng, TDE's etc], "Project Management")

    Conf.PNG

  • GetITDone
    Options

    Hi Paul

    I applied this however I change all the answers to Yes which provided 100% Great!  But then I changed 5 out of the 10 answers to = NA.  the score went down to 50% and needs to remain 100% because we do not want those NA calculated into the scores. 

    Capture1.PNG

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    Try the below formula. It should simplify things greatly for you...

     

    =SUMIFS(Yes:Yes, [Department - ie: Sales Eng, TDE's etc]:[Department - ie: Sales Eng, TDE's etc], "Project Management") / COUNTIFS(Yes:Yes, ISNUMBER(@cell), [Department - ie: Sales Eng, TDE's etc]:[Department - ie: Sales Eng, TDE's etc], "Project Management")

     

    You are summing the Yes column if the department column = (in this example) Project Management. You are then dividing it by how many cells in the Yes column contain a number and are in the same row where the department is (in this example) Project Management.

  • GetITDone
    Options

    Sorry I didn't have your formula in there .  I put this one in but get Unparseable.

    =SUM(Yes183, Yes206, Yes208, Yes228, Yes229, Yes230, Yes250, Yes252, Yes263, Yes291) / (COUNT([Department - ie: Sales Eng, TDE's etc]183, [Department - ie: Sales Eng, TDE's etc]206, [Department - ie: Sales Eng, TDE's etc]208, [Department - ie: Sales Eng, TDE's etc]228, [Department - ie: Sales Eng, TDE's etc]229, [Department - ie: Sales Eng, TDE's etc]230, [Department - ie: Sales Eng, TDE's etc]250, [Department - ie: Sales Eng, TDE's etc]252, [Department - ie: Sales Eng, TDE's etc]263, [Department - ie: Sales Eng, TDE's etc]291) - (COUNTIF(Yes183, ="NA") + (COUNTIF(Yes206, ="NA") + (COUNTIF(Yes208, ="NA") + (COUNTIF(Yes228, ="NA") + (COUNTIF(Yes229, ="NA") + (COUNTIF(Yes230, ="NA") + (COUNTIF(Yes250, ="NA") + (COUNTIF(Yes252, ="NA") + (COUNTIF(Yes263, ="NA") + COUNTIF(Yes291, ="NA")))))))))))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Options

    Your formula above has too many parenthesis in it. Try this version...

     

    =SUM(Yes183, Yes206, Yes208, Yes228, Yes229, Yes230, Yes250, Yes252, Yes263, Yes291) / (COUNT([Department - ie: Sales Eng, TDE's etc]183, [Department - ie: Sales Eng, TDE's etc]206, [Department - ie: Sales Eng, TDE's etc]208, [Department - ie: Sales Eng, TDE's etc]228, [Department - ie: Sales Eng, TDE's etc]229, [Department - ie: Sales Eng, TDE's etc]230, [Department - ie: Sales Eng, TDE's etc]250, [Department - ie: Sales Eng, TDE's etc]252, [Department - ie: Sales Eng, TDE's etc]263, [Department - ie: Sales Eng, TDE's etc]291) - COUNTIF(Yes183, ="NA") + COUNTIF(Yes206, ="NA") + COUNTIF(Yes208, ="NA") + COUNTIF(Yes228, ="NA") + COUNTIF(Yes229, ="NA") + COUNTIF(Yes230, ="NA") + COUNTIF(Yes250, ="NA") + COUNTIF(Yes252, ="NA") + COUNTIF(Yes263, ="NA") + COUNTIF(Yes291, ="NA"))