+ Reply to Thread
Results 1 to 5 of 5

Sumproduct with datediff

Hybrid View

  1. #1
    Registered User
    Join Date
    04-20-2009
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    18

    Sumproduct with datediff

    I have a spreadsheet which records the history of incoming drawings and outgoing comments.

    Column A: Drawing number
    Column B: Issue number
    Column C: Date rec'd,
    Column D: Date comments returned

    I need to generate a series of reports and have used the following formula

    How many drawings rec'd in 2011:
    SUMPRODUCT(--(YEAR(Record!C4:Record!C30)=2011))

    How many drawings rec'd in January 2012
    SUMPRODUCT(--(YEAR(Record!C4:Record!C30)=2012),--(MONTH(Record!C4:Record!C30)=1))

    How many drawings rec'd in January 2012, issue 1
    SUMPRODUCT(--(YEAR(Record!C4:Record!C30)=2012),--(MONTH(Record!C4:Record!C30)=1),--(Record!B4:Record!B30=1))

    Question:
    I now want to check which ones have had comments returned within 14 days. Was trying to use datediff between Column C and Column D and added into the example above.
    i.e. How many drawings rec'd in January 2012, issue 1, comments returned within 14 days

    Can anyone help me either on how to add into my existing formula or suggest an alternative approach?

    Thanks
    Last edited by onthecauseway; 02-06-2012 at 10:49 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sumproduct with datediff

    Try subtracting dates, e.g.

    SUMPRODUCT(--(YEAR(Record!C4:Record!C30)=2012),--(Record!D4:Record!D30-Record!C4:Record!C30<=14),--(Record!B4:Record!B30=1))
    Where there is a will there are many ways.

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

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

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Sumproduct with datediff

    Try

    =SUMPRODUCT(--(YEAR(Record!C4:Record!C30)=2012),--(MONTH(Record!C4:Record!C30)=1),--(Record!D4:Record!D30-Record!C4:Record!C30<=14),--(Record!B4:Record!B30=1))

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Sumproduct with datediff

    Also no need to duplicate the sheet references..

    SUMPRODUCT(--(YEAR(Record!C4:C30)=2012),--(Record!D4:D30-Record!C4:C30<=14),--(Record!B4:B30=1))

    should work.

    You may need to add back the month check if that is necessary... I didn't assume it was...

  5. #5
    Registered User
    Join Date
    04-20-2009
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Sumproduct with datediff

    Thanks, that works.

+ 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