+ Reply to Thread
Results 1 to 6 of 6

countifs

  1. #1
    Registered User
    Join Date
    07-18-2012
    Location
    Appleton, Wisconsin
    MS-Off Ver
    Excel 2007
    Posts
    2

    countifs

    I am trying to use a CountIFS statement to get a total of 1 column, but only if another column is a specific value:

    So Column A is the column I am summing based on the value and Column Q needs to be a value of "1" to even be included:

    When I do the following (only inserting the a Criteria, it works):

    =(COUNTIF(A6:A347,"VL")*2)+(COUNTIF(A2:A347,"L")*10)+(COUNTIF(A2:A347,"ML")*40)+(COUNTIF(A2:A347,"M")*80)+(COUNTIF(A2:A347,"H")*150)+(COUNTIF(A2:A347,"VC")*460)

    I thought I could do the following to add in the other column criteria (Q); but it doesn't work:

    =(COUNTIFS(A6:A347,"VL",Q6:Q347 = "1")*2)+(COUNTIFS(A2:A347,"L",Q6:Q347 = "1")*10)+(COUNTIFS(A2:A347,"ML",Q6:Q347 = "1")*40)+(COUNTIFS(A2:A347,"M",Q6:Q347 = "1")*80)+(COUNTIFS(A2:A347,"H",Q6:Q347 = "1")*150)+(COUNTIFS(A2:A347,"VC",Q6:Q347 = "1")*460)

    Please help - I want the original countif to work as it does (first line above) but only when colum Q = "1".

    Thanks

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: countifs

    You can get corrected syntax for your formulas by pressing F1 and reading the builtin examples for the functions.

    COUNTIF uses pairs of parameters. You paired the first two, but then you made a "formula" out to of the next two.

    COUNTIFS(Range1, Test1, Range2, Test2, Range3, Test3)

    COUNTIFS(A6:A347, "VL", Q6:Q347, 1)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: countifs

    Welcome to the forum.

    Try

    =(COUNTIFS(A6:A347,"VL",Q6:Q347,1)*2)+(COUNTIFS(A2:A347,"L",Q6:Q347,1)*10)+(COUNTIFS(A2:A347,"ML",Q6:Q347,1)*40)+(COUNTIFS(A2:A347,"M",Q6:Q347,1)*80)+(COUNTIFS(A2:A347,"H",Q6:Q347,1)*150)+(COUNTIFS(A2:A347,"VC",Q6:Q347,1)*460)

  4. #4
    Registered User
    Join Date
    07-18-2012
    Location
    Appleton, Wisconsin
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: countifs

    I had tried that, but tried it again and I get a VALUE error. It will work if I only add it to 1 of the multiple COUNTIFs functions, but not when I try to do more than 1.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: countifs

    Ah, I just noticed that your ranges don't match. Change all those A2's to A6's and you should be OK.

  6. #6
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: countifs

    Try this,

    =SUM(COUNTIFS(A2:A347,{"VL","L","ML","M","H","VC"},Q2:Q347,1)*{2,10,40,80,150,460})

    Two ranges must be in same size
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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