+ Reply to Thread
Results 1 to 6 of 6

Trying to include "Blank Cells" in a SUMIFS formula

  1. #1
    Forum Contributor
    Join Date
    08-28-2015
    Location
    Montreal, Canada
    MS-Off Ver
    2013 on PC, 2011 on MAC
    Posts
    159

    Trying to include "Blank Cells" in a SUMIFS formula

    I have this formula, that filters a list of dates in a table. There are three criterias, the first two work fine, but I'm struggling with the third argument.

    =SUMIFS(...CARNETJDV[[#All],[VNTDATE]],">"&'HIDDEN CODES'!$E$33)

    The bold part is where I'm stuck. Third criteria should work like an "OR", which would include the ">"&'HIDDEN CODES'!$E$33 OR ANY BLANK CELLS IN CARNETJDV[[#All],[VNTDATE]].

    So basically, return the sum of any transaction closed after the ending date, contained in 'HIDDEN CODES'!$E$33...OR...still open (which is identified by a blank cell, since there are no closing dates).

    Anyone has an idea ?

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Trying to include "Blank Cells" in a SUMIFS formula

    All arguments in SUMIFS() work like AND, not OR. Hard to say for sure without seeing a sample WB, but perhaps add 2 SUMIFS() together, or use something like...
    =SUM(SUMIF(sum range, criteria range ,{"criteria1","Criteria1"}))
    You may not need the "" if your criteria is numeric

    If that doesn't work, upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    08-28-2015
    Location
    Montreal, Canada
    MS-Off Ver
    2013 on PC, 2011 on MAC
    Posts
    159

    Re: Trying to include "Blank Cells" in a SUMIFS formula

    The problem is, I can't use "" to refer to empty cells in a SUMIFS fonction, given the syntax of the formula. And I tried to come up with something with either OR, AND or ISBLANK, but can't figure out how to make it work.

    The file is attached to this message. The formula in question is in cell E8.

    First two argument of the SUMIFS fonction are:
    - IF Date in column G is higher or equal to the date in 'HIDDEN CODES' cell E32.
    - IF Date in column G is lower or equal to the date in 'HIDDEN CODES' cell E33.

    This gives me a specific array of transaction to look into. This is where it gets tricky. From this array, I need to SUM the profits (Column M) of every transaction that has closing date (Column K) higher the ending date ('HIDDEN CODES' cell E33) AND possible transactions that haven't been closed yet (Empty cells in Column K), but only within the array previously delimited by the first two arguments.

    If you take a look at the file attached to this message, the correct dates have been entered...and E8 should return a sum of 270. Which is the +$6,320 in M82 (which is taken into account right now, because it has a closing date)...but it doesn't add the ones without a closing date (M81, M83, M84 and M85), which should be counted since it's within the array delimited by the first two arguments.
    Attached Files Attached Files
    Last edited by KomicJ; 10-28-2015 at 05:51 PM.

  4. #4
    Forum Contributor
    Join Date
    08-28-2015
    Location
    Montreal, Canada
    MS-Off Ver
    2013 on PC, 2011 on MAC
    Posts
    159

    Re: Trying to include "Blank Cells" in a SUMIFS formula

    Basically, in an ideal world, the formula would look something like this (key part in bold):

    =SUMIFS(CARNETJDV[[#All],[VNTPROF]],CARNETJDV[[#All],[ACHDATE]],">="&'HIDDEN CODES'!$E$32,CARNETJDV[[#All],[ACHDATE]],"<="&'HIDDEN CODES'!$E$33,CARNETJDV[[#All],[VNTDATE]],OR(">"&'HIDDEN CODES'!$E$33,"="&""""))

    or

    =SUMIFS(CARNETJDV[[#All],[VNTPROF]],CARNETJDV[[#All],[ACHDATE]],">="&'HIDDEN CODES'!$E$32,CARNETJDV[[#All],[ACHDATE]],"<="&'HIDDEN CODES'!$E$33,OR(CARNETJDV[[#All],[VNTDATE]]>'HIDDEN CODES'!$E$33,CARNETJDV[[#All],[VNTDATE]]=""))
    Last edited by KomicJ; 10-28-2015 at 05:59 PM.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Trying to include "Blank Cells" in a SUMIFS formula

    1. Your "dates" in Hidden Codes are text, not dates. Change that formula to this...
    =IF(ISBLANK(CARNET!$C$5),DATE(1900,1,1),CARNET!$C$5)

    2. your formula...
    =SUMIFS(CARNET!$M$23:$M$85,
    CARNET!$G$23:$G$85,">="&'HIDDEN CODES'!$E$32,
    CARNET!$G$23:$G$85,"<="&'HIDDEN CODES'!$E$33,
    CARNET!$K$23:$K$85,">"&'HIDDEN CODES'!$E$33)
    if you look at the last rule, you are looking for all entries later than E33 - no records match that

    Try this...
    =SUMIFS(CARNET!$M$23:$M$85,
    CARNET!$G$23:$G$85,">="&'HIDDEN CODES'!$E$32,
    CARNET!$G$23:$G$85,"<="&'HIDDEN CODES'!$E$33,
    CARNET!$K$23:$K$85,"")

  6. #6
    Forum Contributor
    Join Date
    08-28-2015
    Location
    Montreal, Canada
    MS-Off Ver
    2013 on PC, 2011 on MAC
    Posts
    159

    Re: Trying to include "Blank Cells" in a SUMIFS formula

    Thanks for the DATE fonction, was bothering me, and had no idea there was one.

    For the third rule, there is one match. In the version of the document I attached, E33 = 2015-10-22. Transaction on line 82 fits all three criterias. Purchased on 2015-10-13, so between E32 (2015-10-01) and E33 (2015-10-22), and closed on 2015-10-23, so later than E33 (2015-10-22).

    That being said, your suggestion worked. I just kept the first SUMIFS I had, to which I added a second SUMIFS with the "" instead of ">"&'HIDDEN CODES'$E$33 and it worked. Makes for quite a long formula though, but the result is correct. I was under the impression that I had to use the "=" for it to work.

    So fonction lines read like this:

    =SUMIFS(CARNETJDV[[#All],[VNTPROF]],
    CARNETJDV[[#All],[ACHDATE]],">="&'HIDDEN CODES'!$E$32,
    CARNETJDV[[#All],[ACHDATE]],"<="&'HIDDEN CODES'!$E$33,
    CARNETJDV[[#All],[VNTDATE]],">"&'HIDDEN CODES'!$E$33)
    +
    SUMIFS(CARNETJDV[[#All],[VNTPROF]],
    CARNETJDV[[#All],[ACHDATE]],">="&'HIDDEN CODES'!$E$32,
    CARNETJDV[[#All],[ACHDATE]],"<="&'HIDDEN CODES'!$E$33,
    CARNETJDV[[#All],[VNTDATE]],"")

+ 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] Keeping particular cell blank if the related cells show "0" or "blank"
    By Anuru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-24-2014, 05:30 AM
  2. [SOLVED] Replace all BLANK cells in column with header title "Balance" to "0"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2014, 09:25 AM
  3. SUMIFS with "AND/OR" (Ignoring Blank Criteria)
    By SCLisi in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-26-2013, 06:55 PM
  4. solution for the blank cell using the IF function
    By ragnaedge in forum Excel General
    Replies: 4
    Last Post: 08-23-2013, 11:03 AM
  5. Help Needed to get Filters Using "Include" and "Exclude" multiple values on one column.
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2012, 04:03 AM
  6. can a "MINIF" formula be built, equivalent to "SUMIFS"?
    By jrtaylor in forum Excel General
    Replies: 4
    Last Post: 10-22-2011, 12:44 PM
  7. Replies: 3
    Last Post: 02-16-2011, 02:55 PM

Tags for this Thread

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