Results 1 to 14 of 14
  1. #1
    3 Star Lounger
    Join Date
    Aug 2003
    Location
    Voorhees, New Jersey
    Posts
    200
    Thanks
    0
    Thanked 0 Times in 0 Posts

    =SUMIF question ('97, SR-2)

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: =SUMIF question ('97, SR-2)

    Use the concatenation operator &:

    ">"&AA12

  3. #3
    3 Star Lounger
    Join Date
    Aug 2003
    Location
    Voorhees, New Jersey
    Posts
    200
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

    Once again...worked like a charm.

    Muchos gracias!

  4. #4
    Lounger
    Join Date
    Oct 2003
    Location
    Birmingham, England
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

    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?)

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: =SUMIF question ('97, SR-2)

    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

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: =SUMIF question ('97, SR-2)

    (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)

  7. #7
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

    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
    Thanks,

    pmatz

  8. #8
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Missouri, USA
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

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

  9. #9
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

    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

    <img src=/S/coffeetime.gif border=0 alt=coffeetime width=32 height=48>
    Thanks,

    pmatz

  10. #10
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Missouri, USA
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

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

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: =SUMIF question ('97, SR-2)

    Shades' formula

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

    should do what you want, or alternatively

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

    entered as an array formula, i.e. confirm with Ctrl+Shift+Enter instead of just Enter. Explanation: an expression such as Range1>A1 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:

    <table border=1> <td>Range1</td> <td>Range1>Cell1</td> <td>Range1<Cell2</td> <td>(Range1>Cell1)*(Range1<Cell2)</td> <td>Range2</td> <td>(Range1>Cell1)*(Range1<Cell2)*Range2</td> <td align=right>1</td> <td align=right>FALSE</td> <td align=right>TRUE</td> <td align=right>0</td> <td align=right>2</td> <td align=right>0</td> <td align=right>2</td> <td align=right>FALSE</td> <td align=right>TRUE</td> <td align=right>0</td> <td align=right>4</td> <td align=right>0</td> <td align=right>3</td> <td align=right>TRUE</td> <td align=right>TRUE</td> <td align=right>1</td> <td align=right>8</td> <td align=right>8</td> <td align=right>4</td> <td align=right>TRUE</td> <td align=right>TRUE</td> <td align=right>1</td> <td align=right>16</td> <td align=right>16</td> <td align=right>5</td> <td align=right>TRUE</td> <td align=right>TRUE</td> <td align=right>1</td> <td align=right>32</td> <td align=right>32</td> <td align=right>6</td> <td align=right>TRUE</td> <td align=right>FALSE</td> <td align=right>0</td> <td align=right>64</td> <td align=right>0</td> <td align=right> </td> <td align=right> </td> <td align=right> </td> <td align=right> </td> <td align=right> </td> <td align=right> </td> <td>Cell1</td> <td align=right>2</td> <td align=right> </td> <td align=right> </td> <td>Sum</td> <td align=right>56</td> <td>Cell2</td> <td align=right>6</td> <td align=right> </td> <td align=right> </td> <td align=right> </td> <td align=right> </td> </table>

  12. #12
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: =SUMIF question ('97, SR-2)

    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)
    <pre>=SUM(if((Range1>A1)*(Range1<B1),Range2))</pre>


    Steve

  13. #13
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: =SUMIF question ('97, SR-2)

    Or a "creative application of the feature set" <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  14. #14
    4 Star Lounger
    Join Date
    Aug 2003
    Location
    Stroud, United Kingdom
    Posts
    548
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: =SUMIF question ('97, SR-2)

    Thanks !

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

    Thats great stuff [img]/forums/images/smilies/biggrin.gif[/img]
    Thanks,

    pmatz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •