+ Reply to Thread
Results 1 to 14 of 14

SUMIF but not if cell is blank

  1. #1
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    SUMIF but not if cell is blank

    I'm not sure why SUMIFs confuse me so much but they do... I'm hoping someone can work this out for me

    I have the following formula in place and it works great. However, I need to add another IF function to it and don't know how. If A20 is blank, I don't want anything added at all.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,317

    Re: SUMIFs

    Try...

    =IF(Kronos1!A20="","",SUMIF(Kronos1!$C$11:$C$1009,"*"&Kronos1!D11&"*",Kronos1!$F$11:$F$1009))
    HTH
    Regards, Jeff

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,501

    Re: SUMIFs

    I'm thinking that simply adding an if statement to the beginning might do it.
    something like ... IF(Kronos1!A20="","",SUMIF(Kronos1!C11:C1009,"*"&Kronos!$D11&"*",Kronos1!F11:F1009))
    guessing that the A20 is in the Kronos1 sheet.

    EDIT: I see i'm not the first to come up with that idea.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Registered User
    Join Date
    08-29-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    12

    Re: SUMIFs

    jeffreybrown and Sambo kid - Sorry to piggyback on someone elses post, but would the above suggestions from you both work in theory if I needed the formula to do the same but when a single cell within an entire column was blank?

    For example A1 = 1, A2 = 2, A3 = 3, A4 = BLANK, A5 = 5

    I've tried it as below:
    IF(Kronos1!A:A="","",SUMIF(Kronos1!C11:C1009,"*"&Kronos!$D11&"*",Kronos1!F11:F1009))

    but it doesn' t seem to work.

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,317

    Re: SUMIF but not if cell is blank

    Hi MrChrisP,

    My first thought, no. As written that probably will not work as you desire.

    We do have a rule about hijacking a thread. If you have a pertinent question of your own, please start your own thread, and if necessary, link back to this thread if you believe it will help.

    Also, often times it is easier to answer a query when a sample workbook is attached with a clear before and after.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,918

    Re: SUMIF but not if cell is blank

    Delete post.

  7. #7
    Registered User
    Join Date
    08-29-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    12

    Re: SUMIF but not if cell is blank

    Hi jeffreybrown,

    Thanks for the response and apologies I must have missed the rule.

    I don't have a specific reason for my question it was more just to gain a better understanding of how the formula works. I saw the question and it perked my interest is all.

    I'll have another read through the rules and will make sure I stick by them from now on.

    Many thanks,
    MrChrisP

  8. #8
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: SUMIFs

    Quote Originally Posted by jeffreybrown View Post
    Try...

    =IF(Kronos1!A20="","",SUMIF(Kronos1!$C$11:$C$1009,"*"&Kronos1!D11&"*",Kronos1!$F$11:$F$1009))
    A20 is located on the active sheet, so having Kronos1!A20 wouldn't be correct but I adjusted the formula to:

    Please Login or Register  to view this content.
    The code you provided will add the figures as needed but if A20 is blank, the formula you provided still adds the figures. Since A20 actually has a formula in it, do you believe that is what might be causing the issue? The formula in A20 is a simple ='Sheet1'!A3 formula.
    Last edited by Gtrtim112; 12-11-2018 at 09:32 PM.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,317

    Re: SUMIF but not if cell is blank

    How about attaching a sample workbook!

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,791

    Re: SUMIFs

    Are you sure that your SUMIF function actually returns a value other than 0? You might have your sheet set up to show blanks instead of zeros.

    This is the correct syntax for your final attempt:

    =IF(A20<>"",SUMIF(Kronos1!$C$11:$C$1009,"*"&Kronos1!D11&"*",Kronos1!$F$11:$F$1009),"")

    Hope this helps.

    Pete

  11. #11
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: SUMIFs

    Quote Originally Posted by Pete_UK View Post
    Are you sure that your SUMIF function actually returns a value other than 0? You might have your sheet set up to show blanks instead of zeros.
    Sorry Pete... no dice. It still didn't work. I will attach an example in response to Jeffrey.

  12. #12
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: SUMIF but not if cell is blank

    Quote Originally Posted by jeffreybrown View Post
    How about attaching a sample workbook!
    Sorry I didn't sooner. The actual workbook is pretty huge. I had to remove several macros, sensitive info, etc. Typically, when I ask for assistance, the cell numbers I reference may not be exact. I just have to get the premise of the formula and adjust cell numbers to my actual workbook.

    With that being said, I am attaching an abbreviated example with no macros. You'll be looking at column V. You will see the formula above in the cells of that column, with the adjustments made for the actual workbook.

    Let me know if there are any questions but I think I laid it out in the file so that you will see what I'm after.
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    12-03-2009
    Location
    Florence, Italy
    MS-Off Ver
    Excel 2019
    Posts
    1,796

    Re: SUMIF but not if cell is blank

    Hi All,

    a possible approach:


    =IF(T2>"A",SUMIF(Kronos1!C$2:C$1000,"*"&D2&"*",Kronos1!F$2:F$1000),"")

    Out of curiosity: you could shorten the formula

    =IF(T2>0,SUMIF(Kronos1!C$2:C$1000,"*"&D2&"*",Kronos1!F$2),"")



    Hope that helps
    Last edited by canapone; 12-12-2018 at 04:34 AM.
    -----------------------------------------------------

    At Excelforum, you can say "Thank you!" by clicking the star icon ("Add Reputation") below the post.

    Please, mark your thread [SOLVED] if you received your answer.

  14. #14
    Forum Contributor Gtrtim112's Avatar
    Join Date
    04-12-2013
    Location
    Alabama, USA
    MS-Off Ver
    Excel 2016
    Posts
    332

    Re: SUMIF but not if cell is blank

    Quote Originally Posted by canapone View Post
    Hi All,
    a possible approach:
    =IF(T2>"A",SUMIF(Kronos1!C$2:C$1000,"*"&D2&"*",Kronos1!F$2:F$1000),"").... Hope that helps
    By golly, that did it!

    This forum never ceases to amaze me. Everyone is so helpful. I certainly wish I could return the favor.

    Thanks so much for everyone's assistance!

+ 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 formula with blank cell
    By keshavtale in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-29-2017, 12:46 AM
  2. [SOLVED] Drawing a serious blank - criteria in SUMIF formula to be < a cell value
    By sbeatty in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-18-2017, 05:15 PM
  3. [SOLVED] Sumif if another cell is blank
    By jharvey87 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2017, 11:16 AM
  4. [SOLVED] Sumif - If no blank cell
    By doylzer in forum Excel General
    Replies: 8
    Last Post: 10-28-2015, 05:42 PM
  5. Using a blank cell as a criterion in a SUMIF/S
    By PJCIII in forum Excel General
    Replies: 5
    Last Post: 10-09-2014, 02:36 PM
  6. How to sumif with condition = blank cell?
    By Poey in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-29-2013, 03:24 AM
  7. [SOLVED] SUMIF test for blank/empty cell????
    By Fred Holmes in forum Excel General
    Replies: 4
    Last Post: 10-12-2005, 05:05 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