• =SUMIF question (’97, SR-2)

    Author
    Topic
    #395574

    How do I do a SUMIF where the condition refers to a value in another cell?

    (I want to do it this way so that I can change the value easily without editing the SUMIF entry.)

    It seems to want the condition to be in the form of “>51” (including the quotes).

    I want to give it: >AA12

    Any help would be appreciated.

    Viewing 1 reply thread
    Author
    Replies
    • #735122

      Use the concatenation operator &:

      “>”&AA12

      • #735130

        Once again…worked like a charm.

        Muchos gracias!

        • #735136

          Hans,
          Just out of curiosity, how can ordinary people find this out? It’s not in Help. Is there a sort of Super-Help somewhere, or is this Lounge it (or more precisely, you, Steve, Jan and the others?)

          • #735144

            (Edited by HansV to update link to Excel MVP site)

            I guess it’s a combination of a lot of things:
            – Logical thinking
            – Willingness to experiment
            – Word of mouth from experienced users
            – Knowledge Base
            – Newsgroups (searchable by Google)
            – Mailing lists
            – Dedicated websites (Chip Pearson, John Walkenbach, Excel MVP page, …)
            – And, of course, the Lounge (I learn something new here every day)

            • #735211

              I agree with all your points.

              I learn many things in the playing to try to answer the questions posed. Some of the answers I know, others I have a clue, there are some I have no idea. I just experiment and work it out. My philosophy is to assume there is a way to do it and then try to find it.

              Steve

            • #801727

              Or a “creative application of the feature set” evilgrin

            • #801728

              Or a “creative application of the feature set” evilgrin

            • #735212

              I agree with all your points.

              I learn many things in the playing to try to answer the questions posed. Some of the answers I know, others I have a clue, there are some I have no idea. I just experiment and work it out. My philosophy is to assume there is a way to do it and then try to find it.

              Steve

          • #735145

            (Edited by HansV to update link to Excel MVP site)

            I guess it’s a combination of a lot of things:
            – Logical thinking
            – Willingness to experiment
            – Word of mouth from experienced users
            – Knowledge Base
            – Newsgroups (searchable by Google)
            – Mailing lists
            – Dedicated websites (Chip Pearson, John Walkenbach, Excel MVP page, …)
            – And, of course, the Lounge (I learn something new here every day)

        • #735137

          Hans,
          Just out of curiosity, how can ordinary people find this out? It’s not in Help. Is there a sort of Super-Help somewhere, or is this Lounge it (or more precisely, you, Steve, Jan and the others?)

      • #735131

        Once again…worked like a charm.

        Muchos gracias!

      • #801562

        Hans, is there a way of doing a SUMIF with an AND?

        I cant find one, but want the following

        =SUMIF( range1, “>” & cell1 AND “<" & cell2, range2)

        to acheive this i have done two sum ifs, one on each of the cells, and then subtracted one from the other to give the correct result, but was wondering if there was an 'AND' function that allowed for this. I know the AND function is a boolean, so I dont think I can use this.

        Thanks

        • #801569

          Try SUMPRODUCT((Range1>A1)*(Range1<B1)*(Range2))

          • #801605

            Ah, I think I have not communicated what I wanted to do.

            I want to sum values in range2 only if the values in range1 are greater than cell1 and less than cell2. Or to put it another way, if the values in range 1 are between certain values.

            I wonder if I could use an array formula? I dont really understand what array formulas are

            coffeetime

            • #801615

              The SUMRPODUCT will do that. (I used A1 for Cell 1 and B1 for Cell 2).

            • #801616

              The SUMRPODUCT will do that. (I used A1 for Cell 1 and B1 for Cell 2).

            • #801621

              Shades’ formula

              =SUMPRODUCT((Range1>A1)*(Range1A1)*(Range1A1 results in an array of TRUE/FALSE values. The formula uses the fact that TRUE = 1 and FALSE = 0. Perhaps this table with intermediate results helps:

              Range1 Range1>Cell1 Range1<Cell2 (Range1>Cell1)*(Range1<Cell2) Range2 (Range1>Cell1)*(Range1<Cell2)*Range2
              1 FALSE TRUE 0 2 0
              2 FALSE TRUE 0 4 0
              3 TRUE TRUE 1 8 8
              4 TRUE TRUE 1 16 16
              5 TRUE TRUE 1 32 32
              6 TRUE FALSE 0 64 0
              Cell1 2 Sum 56
              Cell2 6
            • #801864

              Thanks !

              I understand now (thanks Hans) the True and False multiplied to either sum the range or not.

              Thats great stuff

            • #801865

              Thanks !

              I understand now (thanks Hans) the True and False multiplied to either sum the range or not.

              Thats great stuff

            • #801622

              Shades’ formula

              =SUMPRODUCT((Range1>A1)*(Range1A1)*(Range1A1 results in an array of TRUE/FALSE values. The formula uses the fact that TRUE = 1 and FALSE = 0. Perhaps this table with intermediate results helps:

              Range1 Range1>Cell1 Range1<Cell2 (Range1>Cell1)*(Range1<Cell2) Range2 (Range1>Cell1)*(Range1<Cell2)*Range2
              1 FALSE TRUE 0 2 0
              2 FALSE TRUE 0 4 0
              3 TRUE TRUE 1 8 8
              4 TRUE TRUE 1 16 16
              5 TRUE TRUE 1 32 32
              6 TRUE FALSE 0 64 0
              Cell1 2 Sum 56
              Cell2 6
            • #801633

              Another array (my preference, since it allows one to use the other stat functions, count, average, stddev, min, max, etc) is (confirm with ctrl-shift-enter)

              =SUM(if((Range1>A1)*(Range1<B1),Range2))

              Steve

            • #801634

              Another array (my preference, since it allows one to use the other stat functions, count, average, stddev, min, max, etc) is (confirm with ctrl-shift-enter)

              =SUM(if((Range1>A1)*(Range1<B1),Range2))

              Steve

          • #801606

            Ah, I think I have not communicated what I wanted to do.

            I want to sum values in range2 only if the values in range1 are greater than cell1 and less than cell2. Or to put it another way, if the values in range 1 are between certain values.

            I wonder if I could use an array formula? I dont really understand what array formulas are

            coffeetime

        • #801570

          Try SUMPRODUCT((Range1>A1)*(Range1<B1)*(Range2))

      • #801563

        Hans, is there a way of doing a SUMIF with an AND?

        I cant find one, but want the following

        =SUMIF( range1, “>” & cell1 AND “<" & cell2, range2)

        to acheive this i have done two sum ifs, one on each of the cells, and then subtracted one from the other to give the correct result, but was wondering if there was an 'AND' function that allowed for this. I know the AND function is a boolean, so I dont think I can use this.

        Thanks

    • #735123

      Use the concatenation operator &:

      “>”&AA12

    Viewing 1 reply thread
    Reply To: =SUMIF question (’97, SR-2)

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

    Your information: