+ Reply to Thread
Results 1 to 10 of 10

Sumproduct/Sum Date Range down to second

  1. #1
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    466

    Sumproduct/Sum Date Range down to second

    Hello,

    I am using these two formulas, and I have having an issue with returning date/time for the last second of the hour.

    For example if the time is 12:59:59, it's ignoring it. If I manually change the time to 12:59:58 it returns the data.

    I am not sure why, as <=B40 time is 12:59:59 for this example.

    I can create a sample sheet if it is helpful.

    =SUMPRODUCT(--((WEEKDAY(Table1[Unit Date])=INDEX(SEQUENCE(7),MATCH($A$38,{"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"},0)))*((MOD(Table1[Unit Date],1)>=$A40)*((MOD(Table1[Unit Date],1)<=$B40)*(Table1[Unit Date]>0)*(Table1[Transaction Type])=5)*(Table1[Status]="Completed"))))

    =IFERROR(SUM(IF(WEEKDAY(Table1[Unit Date])=INDEX(SEQUENCE(7),MATCH($A$38,{"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"},0)),IF(MOD(Table1[Unit Date],1)>=$A40,IF(MOD(Table1[Unit Date],1)<=$B40,IF(Table1[Transaction Type]=5,IF(Table1[Status]="Completed",Table1[Requested / Deposited Amount])))))),0)

    Thanks for any help,
    Nick

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,807

    Re: Sumproduct/Sum Date Range down to second

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    466

    Re: Sumproduct/Sum Date Range down to second

    Hello, here is a sample.

    Thanks,
    Nick
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,807

    Re: Sumproduct/Sum Date Range down to second

    Show your times as decimals on the two sheets and you will see that they are not equal. You may want to use a round up on the decimal formats and then change the format to date/times.

  5. #5
    Forum Contributor
    Join Date
    05-08-2020
    Location
    Lublin, Poland
    MS-Off Ver
    365v.2409 - office laptop (used also elsewhere); 2016 - office desktop, 2010, 2019 - private laptop
    Posts
    196

    Re: Sumproduct/Sum Date Range down to second

    I suppose that there may be something wrong with internal date/time representation in Excel.
    B4 (12:59:59 AM without a date) in Sheet2 expands as a "normal" number to 0.0416550925925926 whereas E2 (3.5.2024 12:59:59 AM) in Data expands as a "normal" number to 45415.0416550926.

    EDIT
    Things are even a little more complicated - see the attached file, top 12 rows in columns R,S,T in Sheet2.
    Attached Files Attached Files
    Last edited by PKowalik; 06-22-2024 at 05:33 PM.
    Przemyslaw Kowalik, Lublin Univ. of Technology

  6. #6
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    2,003

    Re: Sumproduct/Sum Date Range down to second

    Sheet2

    M4=SUMPRODUCT((MOD(Table1[Unit Date],1)>=Sheet2!$A4)*(MOD(Table1[Unit Date],1)<=ROUND(Sheet2!$B4,10))*(Table1[Transaction Type]=5)*(TEXT(INT(Table1[Unit Date]),"dddd")=Sheet2!$A$2))

    Copy down

    N4=SUMPRODUCT((MOD(Table1[Unit Date],1)>=Sheet2!$A4)*(MOD(Table1[Unit Date],1)<=ROUND(Sheet2!$B4,10))*(Table1[Transaction Type]=5)*(Table1[Requested / Deposited Amount])*(TEXT(INT(Table1[Unit Date]),"dddd")=Sheet2!$A$2))

    copy down

  7. #7
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    466

    Re: Sumproduct/Sum Date Range down to second

    Thank you Caracalla, I used your formulas and added more data to the sample (attached) and it is still off a bit.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    2,003

    Re: Sumproduct/Sum Date Range down to second

    Sheet2

    M4=SUMPRODUCT((MOD(Table1[Unit Date],1)>=Sheet2!$A4)*(MOD(Table1[Unit Date],1)<=ROUND(Sheet2!$B4,5))*(Table1[Transaction Type]=5)*(TEXT(INT(Table1[Unit Date]),"dddd")=Sheet2!$A$2))

    Copy down

    N4=SUMPRODUCT((MOD(Table1[Unit Date],1)>=Sheet2!$A4)*(MOD(Table1[Unit Date],1)<=ROUND(Sheet2!$B4,5))*(Table1[Transaction Type]=5)*(Table1[Requested / Deposited Amount])*(TEXT(INT(Table1[Unit Date]),"dddd")=Sheet2!$A$2))

    copy down

  9. #9
    Forum Contributor
    Join Date
    07-10-2012
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    466

    Re: Sumproduct/Sum Date Range down to second

    Thanks Caracalla, on the sample I attached that worked, but when I input it into my main spreadsheet, the totals were still off.

    I did end up just making a macro to adjust the 59:59 to 59:58. Not ideal, but it is just a small discrepancy.

    I appreciate everyone's feedback, the report I pull has the data as seen in the samples, and this is the best work around.

    This did give me a lot of insight into why this does happen.

    Thanks,
    Nick

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,807

    Re: Sumproduct/Sum Date Range down to second

    Thanks for the feedback.

+ 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] sumproduct adding date to time range only works for same date
    By mlan in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 04-04-2021, 12:44 PM
  2. Sumproduct or sum if Date Range
    By ROYW1000 in forum Excel General
    Replies: 3
    Last Post: 07-27-2016, 08:12 PM
  3. Sumproduct or sum if Date Range
    By viruzman in forum Excel General
    Replies: 6
    Last Post: 07-27-2016, 12:34 PM
  4. [SOLVED] Sumproduct with date range?
    By tche misere in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-03-2014, 01:13 AM
  5. Replies: 8
    Last Post: 05-14-2012, 02:44 PM
  6. Sumproduct using date range
    By kmlloyd in forum Excel General
    Replies: 3
    Last Post: 12-13-2010, 12:14 PM
  7. Sumproduct from date range
    By KennyG in forum Excel General
    Replies: 1
    Last Post: 04-27-2010, 03:42 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