+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Sumproduct to only add dates before the 15th of month?

  1. #1
    Registered User
    Join Date
    07-08-2011
    Location
    Fairfield, US
    MS-Off Ver
    Excel 2003
    Posts
    3

    Sumproduct to only add dates before the 15th of month?

    I'm hoping you all can help me. I'm on vacation for a few weeks and have literally spent the last two days doing nothing but research and failing to get my function to work!!

    It's for my monthly budget. Each month I put in the due dates for each of my bills. I always have to temporarily add the bills that will be due before the 15th so I can see how much money I really have until I get paid on the 15th. I'm trying to create a cell that will do these calculations for me by looking at the date in the "DUE" column, and if it is before the 15th, sum the "BILL" column.

    I got this to work except for two problems... I want to put "N/A" on the "DUE" column for bills that I'm not paying for that month, but this causes the formula to return #VALUE!. I do know why it does this, but I can't get "ISERROR" to work correctly (returns one value for the entire array). The other problem is that if the cell is blank it adds it (because it's less than 15)

    What am I doing wrong? I know I'm SO close, but I'm also a VBscripter and know that ONE character can corrupt the entire script.

    Here's my formula:
    =SUMPRODUCT((DAY(I27:I30)<15)*(H27:H30))

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Sumproduct to only add dates before the 15th of month?

    Try this Array Formula,

    =SUM(IF(ISNUMBER(1/I27:I30),IF(DAY(I27:I30)<15,H27:H30)))

    Confirmed with CONTROL+SHIFT+ENTER, rather than just ENTER.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

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

    Re: Sumproduct to only add dates before the 15th of month?

    I would add a column where I entered a "skip" text entry, leaving the dates unaltered.

    =SUMPRODUCT((H27:H30="")*(DAY(I27:I30)<15)*(J27:J30))
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    07-08-2011
    Location
    Fairfield, US
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Sumproduct to only add dates before the 15th of month?

    Quote Originally Posted by Haseeb A View Post
    Try this Array Formula,

    =SUM(IF(ISNUMBER(1/I27:I30),IF(DAY(I27:I30)<15,H27:H30)))

    Confirmed with CONTROL+SHIFT+ENTER, rather than just ENTER.
    Thanks for the replies. This is more what I'm looking for. It worked for a second, and when looking at the evaluation to see how it worked I saw how it arrayed the "1/I27:I30".

    It worked and evaluated as "1/I27:I30" but now it's evaluating as "1/I27:I30" and now returning a 0 no matter what. What did I change? It's evaluating the I27:I30 as a single return instead of an array...
    Last edited by Sgt_Utz; 07-08-2011 at 06:09 PM.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Sumproduct to only add dates before the 15th of month?

    Haseeb's formula works for me - did you confirm with CTRL+SHIFT+ENTER? If done correctly you'll see curly braces like { and } around the formula in the formula bar.

    Here's an alternative "non-array" version

    =SUMPRODUCT(ISNUMBER(MATCH(DAY(I27:I30),{1,2,3,4,5,6,7,8,9,10,11,12,13,14},0))+0,H27:H30)
    Audere est facere

  6. #6
    Registered User
    Join Date
    07-08-2011
    Location
    Fairfield, US
    MS-Off Ver
    Excel 2003
    Posts
    3

    Unhappy Re: Sumproduct to only add dates before the 15th of month?

    Quote Originally Posted by daddylonglegs View Post
    Haseeb's formula works for me - did you confirm with CTRL+SHIFT+ENTER? If done correctly you'll see curly braces like { and } around the formula in the formula bar.

    Here's an alternative "non-array" version

    =SUMPRODUCT(ISNUMBER(MATCH(DAY(I27:I30),{1,2,3,4,5,6,7,8,9,10,11,12,13,14},0))+0,H27:H30)
    I looked up what this "control shift enter" thing was and am now edumacated on what that means. That was the problem too! Thanks guys, I'm sure I'll be posting on here again soon.

+ 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