+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    06-22-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    38

    SUMPRODUCT using 2 different date ranges

    Good afternoon!

    I'm having quite a bit of trouble with an excel formula and I've been killing myself trying to figure it out all morning.

    I'm trying to create a SUM formula with a lot of criteria. I can get everything to work, but there is one thing that messes it up. I want to add an "OR" into the SUMPRODUCT formula I'm using. I want the cell to search and sum when a row is between two dates, have a "1" in Discipline Level, and go to a specific school. Here's the catch, I have 2 different schools, "1" & "3", both using different date ranges. No student has both "1" & "3" show up as a school ID. It's either one or the other.

    Date Range for school 1: 9/15/08 - 11/16/09
    Date Range for school 3: 9/02/08 - 11/08/09

    What I'm trying to do is count whenever discipline level "1" appears but only count between the date ranges for their school. Below is the formula I'm using and the info for each column.

    E = Date
    D = Discipline Level ("1")
    K = "School ID"

    =SUMPRODUCT(--('Intervention Summary'!$E$2:$E$200>=DATE(2008,9,15)),--('Intervention Summary'!$E$2:$E$200<=DATE(2008,11,16)),--('Intervention Summary'!$D$2:$D$200=1),--('Intervention Summary'!$K$2:$K$200=1),--('Intervention Summary'!$D$2:$D$200))+(SUMPRODUCT(('Intervention Summary'!$E$2:$E$200<=DATE(2008,9,2)),--('Intervention Summary'!$E$2:$E$200<=DATE(2008,11,8)),--('Intervention Summary'!$D$2:$D$200=1),--('Intervention Summary'!$K$2:$K$200=3),--('Intervention Summary'!$D$2:$D$200)))

    I don't get an error when I enter this formula, but I always end up getting "0" results.

    Any help would be GREATLY appreciated. Thank you!

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,158

    Re: SUMPRODUCT using 2 different date ranges

    Are entries in columns D and K actual numeric entries or are they text?

    Select column D and go to Data|Text to Columns and click Finish...

    Repeat for column K...

    Does that make a difference?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Registered User
    Join Date
    06-22-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: SUMPRODUCT using 2 different date ranges

    They are all numeric. D= 1-9 and K= 1-4 only. There are occasional blanks cells too.

    I tried Text To Columns for both and nothing happened.

  4. #4
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,158

    Re: SUMPRODUCT using 2 different date ranges

    Possible to post worksheet?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  5. #5
    Registered User
    Join Date
    06-22-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: SUMPRODUCT using 2 different date ranges

    Here it is. I've highlight the section I'm working on in the "Cover Page" tab.

  6. #6
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,158

    Re: SUMPRODUCT using 2 different date ranges

    Try:

    Code:
    =SUMPRODUCT(--('Paste Intervention Summary'!$E$2:$E$200>=DATE(2008,9,15)),--('Paste Intervention Summary'!$E$2:$E$200<=DATE(2008,11,16)),--('Paste Intervention Summary'!$D$2:$D$200=1),--('Paste Intervention Summary'!$K$2:$K$200=1))+SUMPRODUCT(--('Paste Intervention Summary'!$E$2:$E$200>=DATE(2008,9,2)),--('Paste Intervention Summary'!$E$2:$E$200<=DATE(2008,11,8)),--('Paste Intervention Summary'!$D$2:$D$200=1),--('Paste Intervention Summary'!$K$2:$K$200=3))
    I got 5 with this...

    You had a few things...

    The second sumproduct had a <= in the 1st condition..should be >=
    You had a missing -- before 1st condition in second Sumproduct
    You don't need the --('Paste Intervention Summary'!$D$2:$D$200) in either Sumproduct, if you are counting...
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Registered User
    Join Date
    06-22-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: SUMPRODUCT using 2 different date ranges

    You my friend, are awesome! It worked perfectly!

    You just saved me tons and tons of grief. Thank you so much!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0