+ Reply to Thread
Results 1 to 14 of 14

Summing ranges based on two (or more) conditions/criteria

  1. #1
    Registered User
    Join Date
    07-27-2007
    Posts
    19

    Summing ranges based on two (or more) conditions/criteria

    OK, I have a cell that I need to make a calculation if certain other cells =Y, or to show "0" if the other cells =N. I can do the calculation for the Y part but how do I add the N part of it? Here is what I have:

    =SUMIF(J19:J40,"Y",H19:H40)*0.08

    Any help would be appreciated. Thanks.

    Using Excel 2007
    Last edited by halvy52; 07-08-2009 at 04:29 PM. Reason: Moderator asked me to.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula Help

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Formula Help

    If you are using Excel 2007, the try using the SUMIFS functions.

    If using a prior version, use the IF function.

    Why don't you edit your profile so that we know which version you are using?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula Help

    Palmetto,

    Please do not reply to threads where a Moderator has requested action to fix something, until that action has been taken..

    Please read Rule 7

  5. #5
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Formula Help

    Can do

  6. #6
    Registered User
    Join Date
    07-27-2007
    Posts
    19

    Re: Formula Help

    Quote Originally Posted by NBVC View Post
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Well I hope you don't take this the wrong way but what should I put for a title? I'm having problems with a formula that I need help with. Not sure what else to title it. How is it such a bad title?

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula Help

    Try something like"

    Summing ranges based on two (or more) conditions/criteria

  8. #8
    Registered User
    Join Date
    07-27-2007
    Posts
    19

    Re: Formula Help

    Quote Originally Posted by NBVC View Post
    Try something like"
    Thank you.

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Summing ranges based on two (or more) conditions/criteria

    Thanks... now... I am not quite sure what your original question really is...

    Do you essentially want 2 sumifs, one that sums the "Y" and one that Sums the "N"... and then multiply each by a different fixed value?

    Can you elaborate a bit?

  10. #10
    Registered User
    Join Date
    07-27-2007
    Posts
    19

    Re: Summing ranges based on two (or more) conditions/criteria

    Quote Originally Posted by NBVC View Post
    Thanks... now... I am not quite sure what your original question really is...

    Do you essentially want 2 sumifs, one that sums the "Y" and one that Sums the "N"... and then multiply each by a different fixed value?

    Can you elaborate a bit?
    Basically It's a tax calculation. I have a column called PST. If I put a Y in that cell I want it to calculate the tax based on the data in the cell beside it. If I put an N I don't want it to calculate anything really, but I just want it to show up as 0. With the formula I'm using now, The "Y" part of it works. But for instance say I put all "N"s for each line item (saying I don't want to charge tax on that item). When I do that it doesn't do the calculations (which is right) but it leaves the cell blank. I would prefer the cell to show $0.00. Would it help if I uploaded the worksheet? I'm probably not explaining this too well.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Summing ranges based on two (or more) conditions/criteria

    Quote Originally Posted by halvy52 View Post
    Would it help if I uploaded the worksheet?
    Yes I think that would help... and put in some expected results...

  12. #12
    Registered User
    Join Date
    07-27-2007
    Posts
    19

    Re: Summing ranges based on two (or more) conditions/criteria

    Quote Originally Posted by NBVC View Post
    Yes I think that would help... and put in some expected results...
    OK. Here it is. The cell in question is H46. Basically if there is a Y in Column J, I want it to calculate the tax at 8% based on Column H (Extended Price). However if there are all N's in Column J, I want H46 to show as $0.00 and not just a blank cell. And alternatively, if you have a better way to do this, that would be great.
    Attached Files Attached Files

  13. #13
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Summing ranges based on two (or more) conditions/criteria

    Well, if I understand it correctly, you could use formula:

    =IF(COUNTIF(J19:J140,"Y")=0,0,SUMIF(J19:J40,"Y",H19:H40)*0.08)

    which would return 0 if there are no "N"'s in column J...

    However, you currently have your sheet set to not show 0's through Tools|Options|View tab...

    If you want to see a zero in that cell, you need to turn that option back on... then you can format the cells in H19:H40 and other ranges through, Format|Cells >> Custom: $#,##0.00;;
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    07-27-2007
    Posts
    19

    Re: Summing ranges based on two (or more) conditions/criteria

    Quote Originally Posted by NBVC View Post
    Well, if I understand it correctly, you could use formula:

    =IF(COUNTIF(J19:J140,"Y")=0,0,SUMIF(J19:J40,"Y",H19:H40)*0.08)

    which would return 0 if there are no "N"'s in column J...

    However, you currently have your sheet set to not show 0's through Tools|Options|View tab...

    If you want to see a zero in that cell, you need to turn that option back on... then you can format the cells in H19:H40 and other ranges through, Format|Cells >> Custom: $#,##0.00;;
    Thank you. Worked perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1