+ Reply to Thread
Results 1 to 7 of 7

Need help with an If and Sumif statement

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    4

    Need help with an If and Sumif statement

    Hello all,
    Thanks in advance for any help. Not exactly an Excel newbie but not a guru either. I'm having trouble with a formula. I want to make sure that the countif (which is essentially the denominator in the equation has a value of > 0, else render 'n/a'. I'm having trouble writing this. If I take out the "n/a" at the end, I will get a value. The sumif/countif formula is ok on its own. It's when I try to incorporate it into an if statement that I'm having my problems. Hopefully I've explained this well enough.

    =IF(COUNTIF(AllReports.$A$4:$A$500,$A4)>0,SUMIF(AllReports.$A$4:$A$500,$A4,AllReports.C$4:C$500))/COUNTIF(AllReports.$A$4:$A$500,$A4),"n/a")

    Thanks,
    John

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,119

    Re: Need help with an If and Sumif statement

    AllReports.$A$4:$A$500
    perhaps it a country version of excel

    AllReports.$A$4:$A$500

    should that read
    AllReports!$A$4:$A$500
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    07-30-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need help with an If and Sumif statement

    Quote Originally Posted by etaf View Post
    perhaps it a country version of excel

    AllReports.$A$4:$A$500

    should that read
    AllReports!$A$4:$A$500
    Thanks for the reply. I'm not sure that's it. If I use the formula: =(SUMIF(AllReports.$A$4:$A$500,$A4,AllReports.D$4:D$500))/COUNTIF(AllReports.$A$4:$A$500,$A4), I get the correct answer. If I try to use this in an If statement, conditional on the results of the COUNTIF, I get an error.

  4. #4
    Registered User
    Join Date
    07-30-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need help with an If and Sumif statement

    It's ok. I had a misplace bracket.

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,119

    Re: Need help with an If and Sumif statement

    what do you get from this test
    COUNTIF(AllReports.$A$4:$A$500,$A4)>0

    true false
    ?

    you have an extra bracket closing the IF here

    ,SUMIF(AllReports.$A$4:$A$500,$A4,AllReports.C$4:C$500))/COUNTIF(AllReports.$A$4:$A$500,$A4)

    try
    ,SUMIF(AllReports.$A$4:$A$500,$A4,AllReports.C$4:C$500)/COUNTIF(AllReports.$A$4:$A$500,$A4)

  6. #6
    Registered User
    Join Date
    07-30-2013
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Need help with an If and Sumif statement

    Quote Originally Posted by etaf View Post
    what do you get from this test
    COUNTIF(AllReports.$A$4:$A$500,$A4)>0

    true false
    ?

    you have an extra bracket closing the IF here

    ,SUMIF(AllReports.$A$4:$A$500,$A4,AllReports.C$4:C$500))/COUNTIF(AllReports.$A$4:$A$500,$A4)

    try
    ,SUMIF(AllReports.$A$4:$A$500,$A4,AllReports.C$4:C$500)/COUNTIF(AllReports.$A$4:$A$500,$A4)
    Thanks Wayne, I found that as well.

  7. #7
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,119

    Re: Need help with an If and Sumif statement

    yep, posted at the same time glad its all sorted now

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] SUMIF with an OR statement
    By mattmorris in forum Excel General
    Replies: 4
    Last Post: 07-18-2012, 09:33 AM
  2. If statement within SUMIF ???
    By mbsmeltzer in forum Excel General
    Replies: 4
    Last Post: 04-18-2011, 10:46 AM
  3. Nested SUMIF statement or multiple SUMIF's
    By Dan27 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-17-2009, 06:55 AM
  4. sumif statement
    By JR573PUTT in forum Excel General
    Replies: 5
    Last Post: 02-17-2006, 12:01 PM
  5. sumif statement
    By Ted Metro in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-07-2005, 01:06 PM

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