+ Reply to Thread
Results 1 to 11 of 11

Sumif based on the RESULT of a Countif

  1. #1
    Registered User
    Join Date
    12-07-2016
    Location
    Oregon, USA
    MS-Off Ver
    2016
    Posts
    33

    Sumif based on the RESULT of a Countif

    Hello Excel Gurus!

    I'm struggling to get my SumIf to work because I want it to sum based on 2 criteria, one of which is that the result of the COuntif is >2. See below


    A B
    ex 1 5 3
    ex 2 4 1
    ex 3 10 6
    ex 4 15 9

    19 sum of A where the VALUE of B:B is <7, AND ONLY if the count of rows in B:B that are <7 is GREATER than 2



    A B
    ex 1 5 15
    ex 2 4 1
    ex 3 10 8
    ex 4 15 9

    0 The number of rows in B:B that have a value <7 is LESS than 2 so no sum.

    I just can't figure out how to get the RESULT of the Countif used as the criteria in the Sumif.

    THANKS for any help!
    Attached Files Attached Files
    Last edited by Betsy Simpkins; 02-12-2018 at 07:35 PM. Reason: add attachment

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Sumif based on the RESULT of a Countif

    Please attach workbook free of sensitive data

    To attach:
    Click GoAdvanced \ look below and click ManageAttachments \ follow screen instructions
    Thanks
    Last edited by kev_; 02-12-2018 at 06:27 PM.

  3. #3
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    485

    Re: Sumif based on the RESULT of a Countif

    Maybe

    =(COUNTIF(B:B,"<7")>2)*SUMIF(B:B,"<7",A:A)

  4. #4
    Registered User
    Join Date
    12-07-2016
    Location
    Oregon, USA
    MS-Off Ver
    2016
    Posts
    33

    Re: Sumif based on the RESULT of a Countif

    Thank you...attached a simple sheet up above with sample data.

  5. #5
    Registered User
    Join Date
    12-07-2016
    Location
    Oregon, USA
    MS-Off Ver
    2016
    Posts
    33

    Re: Sumif based on the RESULT of a Countif

    Thanks...but wouldn't that result in the # of rows that are<7 *the sum of the ones <7? So in my example data above it would end up being 3*19...which is not what I need. I need only the 19.

  6. #6
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Sumif based on the RESULT of a Countif

    don't you just need to use an IF(COUNTIF, SUMIF, 0) ?

    In B6:
    Please Login or Register  to view this content.
    I mean, doing it with Boolean arithmatic like Root suggested is almost equivalent, but this is clearer.

    BTW @ Betsy
    No, you're interpreting the formula wrong.
    Its:
    (COUNTIFS >2) * SUMIFS

    (3 >2) = TRUE => 1
    1 * SUMIFS

    (2 > 2) = FALSE => 0
    0 * SUMIFS

    that's how it will be assessed.
    Last edited by ben_hensel; 02-12-2018 at 10:02 PM.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  7. #7
    Registered User
    Join Date
    02-04-2018
    Location
    Patna, India
    MS-Off Ver
    2010
    Posts
    5

    Re: Sumif based on the RESULT of a Countif

    please try this one
    Attached Files Attached Files

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,955

    Re: Sumif based on the RESULT of a Countif

    Rajxl - sorry for off-topic interjection:

    Although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Registered User
    Join Date
    12-07-2016
    Location
    Oregon, USA
    MS-Off Ver
    2016
    Posts
    33

    Re: Sumif based on the RESULT of a Countif

    Yes! This is perfect. Thank you so much Ben. I REALLY appreciate it. Also thanks for explaining the logic I missed, makes much more sense now. You guys are awesome!

  10. #10
    Registered User
    Join Date
    02-04-2018
    Location
    Patna, India
    MS-Off Ver
    2010
    Posts
    5

    Re: Sumif based on the RESULT of a Countif

    Thank you for your suggestion. I am feeling a mistake, next time I will take care of this matter. English is not my native language.

  11. #11
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Sumif based on the RESULT of a Countif

    @rajxl

    Don't feel too down, we made it an unofficial rule because too many of the old hands were falling into that bad habit...!

+ 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. Countif and Sumif based on year?
    By shhhhh22 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-16-2016, 06:30 PM
  2. [SOLVED] Countif/Sumif/Sumproduct under 80 based on wild card value
    By Groovicles in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-04-2014, 04:23 PM
  3. [SOLVED] sumif & countif formula needed based on dd/mm/yy format - worksheet attached
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-28-2013, 11:32 AM
  4. [SOLVED] Formula needed for countif and sumif based on date format 12/23/13, etc.
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-28-2013, 10:50 AM
  5. [SOLVED] COUNTIF or SUMIF Formula based on other column value needed urgently please?
    By jamieswift1977 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-15-2013, 05:54 AM
  6. [SOLVED] Countif or Sumif based on Conditional Formatting Color
    By Kune in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 10-07-2012, 08:47 AM
  7. Sumif based on Vlookup Result
    By ferris in forum Excel General
    Replies: 3
    Last Post: 09-10-2009, 03:44 AM

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