+ Reply to Thread
Results 1 to 6 of 6

SUMIFS, If no criteria match, leave cell blank, else return value

  1. #1
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    SUMIFS, If no criteria match, leave cell blank, else return value

    Using the information found in this thread: https://www.excelforum.com/excel-gen...urn-value.html I modified the below formula to my needs, but the result is not resulting in a blank cell when the criteria doesn't have any matches.

    The original suggestion:

    Quote Originally Posted by KCchristoph View Post

    =IF(COUNTIF([criteria range], [criteria])>0, SUMIFS([sum range], [criteria range], [criteria]), "")

    example: =IF(COUNTIF(H:H, A2)>0, SUMIFS(I:I, H:H, A2), "")

    This will give you back a blank whenever there isn't a data match to sum,...
    While I am getting the correct value when there is data that matches the criteria, I am still getting a zero when there isn't anything to sum. Where am I going wrong in the formula?

    My modified version:

    Please Login or Register  to view this content.
    Thank you for your help.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: SUMIFS, If no criteria match, leave cell blank, else return value

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: SUMIFS, If no criteria match, leave cell blank, else return value

    Hi eemiller1997- Are you sure SUMIFS is finding any matches? @KCchristoph was proposing a test to avoid such situations, ie:
    =IF(COUNTIFS( $A3:$A26, TODAY(), $H3:$H26, "Admin")>0, SUMIFS($G3:$G26, $A3:$A26, TODAY(), $H3:$H26, "Admin"), " ")

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-02-2017 at 07:16 PM.

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: SUMIFS, If no criteria match, leave cell blank, else return value

    You could also try the following:
    =IFERROR(1/(1/SUMIFS($G3:$G26, $A3:$A26, TODAY(), $H3:$H26, "Admin")), " ")

    All of this, of course, assumes you're not actually using Excel 2000 as your profile suggests. (If you were, SUMIFS wouldn't work at all.)

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee

  5. #5
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: SUMIFS, If no criteria match, leave cell blank, else return value

    Quote Originally Posted by leelnich View Post
    Hi eemiller1997- Are you sure SUMIFS is finding any matches?
    =IF(COUNTIFS( $A3:$A26, TODAY(), $H3:$H26, "Admin")>0, SUMIFS($G3:$G26, $A3:$A26, TODAY(), $H3:$H26, "Admin"), " ")
    This worked. My question is why? Why did first looking for today's date in col A first as well if there are any Admin's in Col H greater than nothing, before calculating the sum for col G for only admins on today's date with Admin?

    It seems the formula is going through the data twice.

    Is it a 2010 thing? I have 2016 at work and I'm finding there are some differences.

    For some reason the forum won't allow me to make an attachment.


    sumifs-question.jpg

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: SUMIFS, If no criteria match, leave cell blank, else return value

    Unfortunately, Excel doesn't let you use a calculated result in two separate operations. So you calculate the result once to test. If in bounds, you have to calculate the same result AGAIN to return. There are a few rather convoluted work-arounds, like the IFERROR solution I offered in post #4, but duplicate calculation is easier to understand, and despite being less efficient, is perfectly adequate for a single-occurrence formula. Such clarity becomes more important over time if, for example, new requirements force changes to the worksheet 6 months from now.

    NOTE: I used COUNTIFS(Range1,test1,Range2,test2) for the test because it's slightly faster. Here's a more literal example of duplicate calculation:
    =IF(SUMIFS( $G3:$G26, $A3:$A26, TODAY(), $H3:$H26, "Admin")>0, SUMIFS($G3:$G26, $A3:$A26, TODAY(), $H3:$H26, "Admin"), " ")

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-03-2017 at 07:36 PM.

+ 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. Replies: 5
    Last Post: 07-02-2017, 10:25 AM
  2. [SOLVED] Leave Date Blank If No Match Criteria
    By werko in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-06-2017, 11:20 PM
  3. [SOLVED] How to return value blank cell, if criteria do not match
    By devawad in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-25-2013, 08:14 AM
  4. [SOLVED] How to return value blank cell, if criteria do not match
    By devawad in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-25-2013, 05:21 AM
  5. Replies: 4
    Last Post: 12-27-2011, 04:26 PM
  6. Replies: 5
    Last Post: 09-07-2011, 11:14 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