• Array Count Formula That Doesn’t Work (Excel 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Array Count Formula That Doesn’t Work (Excel 2003)

    Author
    Topic
    #404792

    I have two array formulas, one that SUMS several figures based on two sets of conditions, and one that COUNTS several figures, based on the same conditions. When I enter the SUM as an array formula, it calculates correctly. However, when I try the same approach using the COUNT as an array, it does not return a valid answer. I have attached a sample file that illustrates the problem.

    Thanks in advance for any assistance on this.

    Viewing 1 reply thread
    Author
    Replies
    • #826058

      (Edited by JohnBF on 11-May-04 14:13. )

      Edited.

      I expanded the values for better testing. It’s easier to use:

      =SUMIF(B2:B4,”<"&B7)-SUMIF(B2:B4,"<"&B6)
      =COUNTIF(B2:B4,"<"&B7)-COUNTIF(B2:B4,"<"&B6)

      • #826266

        Well, John, you’ve come through once again. And as is so often the case with your solutions, it was relatively simple and quite elegant.

        Thanks again…

      • #826267

        Well, John, you’ve come through once again. And as is so often the case with your solutions, it was relatively simple and quite elegant.

        Thanks again…

        • #826708

          Would this work for you

          =SUMPRODUCT(–(B2:B4>B6),–(B2:B4B6),–(B2:B4<B7)) to count?

          • #826802

            Yes, it does work, but I’m not sure why. I tried your formula with one minus sign in front of each array and that worked as well. Could you explain how your formula works?

            Thanks very much for your response. I’ve found the SUMPRODUCT function to be very useful, did not see its use here until you pointed it out.

            • #826855

              The — is used as a coercer. It coerces true/false into 1/0. Similar in fashion to +0, *1. Sumproduct is a useful function for multi-conditional counting and summing. Conversely the — can also coerce numbers formatted as text into real numbers.

            • #826856

              The — is used as a coercer. It coerces true/false into 1/0. Similar in fashion to +0, *1. Sumproduct is a useful function for multi-conditional counting and summing. Conversely the — can also coerce numbers formatted as text into real numbers.

          • #826803

            Yes, it does work, but I’m not sure why. I tried your formula with one minus sign in front of each array and that worked as well. Could you explain how your formula works?

            Thanks very much for your response. I’ve found the SUMPRODUCT function to be very useful, did not see its use here until you pointed it out.

        • #826709

          Would this work for you

          =SUMPRODUCT(–(B2:B4>B6),–(B2:B4B6),–(B2:B4<B7)) to count?

    • #826059

      (Edited by JohnBF on 11-May-04 14:13. )

      Edited.

      I expanded the values for better testing. It’s easier to use:

      =SUMIF(B2:B4,”<"&B7)-SUMIF(B2:B4,"<"&B6)
      =COUNTIF(B2:B4,"<"&B7)-COUNTIF(B2:B4,"<"&B6)

    Viewing 1 reply thread
    Reply To: Reply #826059 in Array Count Formula That Doesn’t Work (Excel 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel