+ Reply to Thread
Results 1 to 30 of 30

SUMPRODUCT & Time (cells containing formula)

  1. #1
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    SUMPRODUCT & Time (cells containing formula)

    Hello experts,

    I am useing sumproduct formula with time:

    =SUMPRODUCT(--(A1:A10>=B2+TIME(0,0,0)*--(A1:A10<B3+TIME(0,0,0)

    Column A contains a cell that has both date and time in it.

    I have extracted the time by useing "=INT" OR "=MOD"

    My formula will not work because the Cell contains a formula.

    If I had to manually type in the time only on the cell, the sumproduct formula would work.

    I need sumproduct b/c I will need to include additional array formula.

    My true data contains 37,000 rows.

    Thanks in advance.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    Maybe this...

    =SUMPRODUCT(--(A1:A10>=B2),--(A1:A10<B3))

    If you're using Excel 2007 or later you can use this version:

    =COUNTIFS(A1:A10,">="&B2,A1:A10,"<"&B3)

    Why do you have these expressions in there:

    B2+TIME(0,0,0)
    B3+TIME(0,0,0)

    That is the same as:

    B2+0
    B3+0

    So, why are you adding 0 to the cell values?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Hello Tony,

    There is not reason to use the time(0.0.0). Its, I guess the blind leading the blind. Thank you for correcting me.

    I tried you suggestion =SUMPRODUCT(--(A1:A10>=B2),--(A1:A10<B3)) work fine but my data is very large and it looks like it is counting duplicates. Was hoping to use sumproduct since I have to filter several other criteria.

    I also used the Contifs with same result where any time that are the same are duplicated maybe more.
    In short, doing it manually, I get 134 and using the formula gives me 305. Interesting enough, when adding additional criteria still keeps the same number which does not make sense.

    =SUMPRODUCT(--(AA5:AA32592<=AC6),--(AA5:AA32592>AC5),--(O5:O32592="service_desk"))
    Last edited by rogrand; 11-08-2013 at 10:00 PM.

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: SUMPRODUCT & Time (cells containing formula)

    If you can, use COUNTIFS as suggested by Tony Valko as it is much faster than SUMPRODUCT and like SUMPRODUCT, COUNTIFS can take many criteria. Just give it the range and the associated criteria separated by commas. Note how Tony uses the comparative operators in the COUNTIF formula. That syntax is important.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    So, it sounds like you only want to count unique entries?

    Can you post a SMALL sample file and tell us what result you expect?

    20 rows worth of data is plenty!

  6. #6
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Hello Tony and others,

    As a singular goal you and other team member have been able to help but as a whole my data keeps getting complicated when combining formulas as I try to include other criteria. In short, too many days have been spent and have not yielded a successful outcome. I have decided to abandon ship no reflection on you or any other member in this forum.

    Thanks again,

    Robert
    Last edited by rogrand; 11-09-2013 at 12:43 AM.

  7. #7
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: SUMPRODUCT & Time (cells containing formula)

    Well. if you give no information, and expect truly valid answers..... Tony's answers gave what you asked, just because you can not combine them the way you want is no reason to "abandon ship", I'm sure Tony ( or others) would help if you gave the parameters actually needed...
    Last edited by dredwolf; 11-09-2013 at 01:03 AM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  8. #8
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Ok. Here is the report with all the moveing parts.
    On the workshett each ticket (A5:A32592) has a time stamp (B5:B32592)

    The time Column contains both date and time in a single cell. example (1/2/2013 7:56:14 AM)

    Need to find how many employees under the the column E (Agents) that matches column C "service_desk", with column E "Agents, matching the helper column "employee"
    Between hours (1 to 2 am, 2 to 3 am, ....ext

    exmaple: on any given day, there should be only 2 to 3 empLoyees that work between 1 and 2 am from the Employee column.

    This would give me a representation on staff needs by seeing occurances of tickets hourly
    and shows me number of staff meeting occurances under the above criteria.


    Takeing each part on its own, I am able to do, but when putting it all together it becomes a monster due to the nature of extracted data.

    Due to size of worksheet I saved it as an xlsb and can be saved back as xls
    Attached Files Attached Files

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    I'd like to help but I have a download file size limit of no more than 50kb.

  10. #10
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    I reduced the file by removing rows. File size is now 48kb. Should be good if what I am tryingto do is possible.


    Anxiously looking forward to your response.


    Thank you,
    Attached Files Attached Files

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: SUMPRODUCT & Time (cells containing formula)

    I took it that the helper column had all the employees and that the Agent column was a mix of employees and non employees. Using that information, I inserted a column and entered a formula to determine which Agents were employees.

    I created a column that took the dates and determined what shift the times fell into (12 shifts per day) and combined this with the day, month and year to create a unique serial number for each shift.

    Seeing that the data was not in date order, I sorted the data into date order to get all the shifts together for each day and to make the end calculation easier to confirm....count the result in column I against the values in column E
    Attached Files Attached Files

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    OK, I downloaded the file.

    Refresh my memory as to what you want to do.

    Is it...

    Count the number of unique agents during the hours of the day that are in a specific group?

    What about the dates? Do you want the count for a specific date?

    So we need to look in columns B, C and G?

    If your real file has 33k rows of data and you want counts for all 24 hrs of the day, then these calculations will be slow and may take a couple of minutes to finish.

  13. #13
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Yes, as an example from 1 am to 2am on 1-1-13 Carlos Piar was working. Since you can see that there is a time where he had a ticket from the column.

    On the date, if you click on a cell has the date & time on it.

    Here is what I wrote above for more info and expected results. Hope it makes sense.


    On the Worksheet each ticket (A5:A32592) has a time stamp (B5:B32592)

    The time Column contains both date and time in a single cell. example (1/2/2013 7:56:14 AM)

    Need to find how many employees under the the column E (Agents) that matches column C "service_desk", with column E "Agents, matching the helper column "employee"
    Between hours (1 to 2 am, 2 to 3 am, ....ext

    example: on any given day, there should be only 2 to 3 employees that work between 1 and 2 am from the Employee column.

    This would give me a representation on staff needs by seeing occurrences of tickets hourly
    and shows me number of staff meeting occurrences under the above criteria.

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    Quote Originally Posted by rogrand View Post

    Need to find how many employees under the the column E (Agents) that matches column C "service_desk", with column E "Agents, matching the helper column "employee"
    Between hours (1 to 2 am, 2 to 3 am,
    How does this sound...

    You want to know how many of the employees in column H worked in the service_desk between the hours of this and that?

  15. #15
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Yes and there respective date. So for example

    On 1-3-13 between this and that, 2 employees worked on the H column that belongs to the "service_desk"

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    Based on the data and structure in your sample file...

    Use cells to hold the criteria:


    J4 = some date like 1/1/2013
    K4 = some hour of the day like 1:00 AM
    L4 = some group like service_desk

    Then, this formula entered in M4:

    =SUMPRODUCT(--(INT(B5:B1439)=J4),--(HOUR(B5:B1439)=HOUR(K4)),--(C5:C1439=L4),--ISNUMBER(MATCH(E5:E1439,H5:H45,0)))

  17. #17
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Hello Tony,


    Great approach, still has hiccups. For example, on date 1-1-2013 from 1 to 2 am there should be two employee from the "service_desk" Column c should yield a total of 2 not 6. David S Anderson and Clint Fowler from the Column H. This is how I into the rabbit hole.

    I am thinking that both employees (David S Anderson and Clint Fowler) got counted more then one time.

  18. #18
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Hello Newdoverman,

    Did not notice your reply Sorry. I like how you added the "Shift" column, easy to q & a the results.

    Two things:
    1. Same as Tony, Employees column is being counted more than once.
    The shift " 1120131" should only show 2 employees on thus shift.

    2. Column I (Employee/shift) should always have an employee working.


    I really have to say I am thankful for you and Tony.

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    Ok, so you DO want to count only the unique agents that meet the conditions.

    This array formula** entered in M4:

    =SUM(IF(FREQUENCY(IF(INT(B5:B1439)=J4,IF(HOUR(B5:B1439)=HOUR(K4),IF(C5:C1439=L4,IF(ISNUMBER(MATCH(E5:E1439,H5:H45,0)),MATCH(E5:E1439,E5:E1439,0))))),ROW(E5:E1439)-ROW(E5)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  20. #20
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Hello Tony,

    There is light at the end of the tunnel after all. I inserted the formual to the spreadsheet I uploaded and worked like a charm.

    However, this was 1/4 of the original due to file size upload.

    I entered it to the original document as I mirrored your formula and received a message:

    "The specified formula cannot be entered because it uses more levels of nesting then are allowed in the current file format."

    Formula entered using the array ctrl,shift, enter

    =SUM(IF(FREQUENCY(IF(INT(L5:L32592)=U5,IF(HOUR(L5:L32592)=HOUR(V5),IF(O5:O32592=W5,IF(ISNUMBER(MATCH(Q5:Q32591,Y5:Y45,0)),MATCH(Q5:Q32592,Q5:Q32592,0))))),ROW(Q5:Q32592)-ROW(Q5)+1),1))


    I denoted the point in which it stops in bold (see above)

    Do formula have limitation in size?
    Last edited by rogrand; 11-10-2013 at 10:57 PM.

  21. #21
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: SUMPRODUCT & Time (cells containing formula)

    Are the files being used under the same versions of excel?, if your uploaded version was 2007 or above, there would be no nesting problem, if the original is under 2003 or earlier, or formatted as that, then the nesting level gets reached very quickly..

  22. #22
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    We're making progress!

    Try this array formula** which should work in ANY version of Excel:

    =SUM(IF(FREQUENCY(IF(TEXT(B5:B1439,"m/d/yyyy h")=TEXT(J4+K4,"d/m/yyyy h"),IF(C5:C1439=L4,IF(ISNUMBER(MATCH(E5:E1439,H5:H45,0)),MATCH(E5:E1439,E5:E1439,0)))),ROW(E5:E1439)-ROW(E5)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  23. #23
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    Some interesting aspects of Excel file types...

    The sample file in *.xlsb (binary format) is only 49kb in size.

    I created a copy in *.xls format and worked on it in Excel 2002 so I could come up with a formula that will work in ANY version of Excel. The *.xls file is 277kb in size.

  24. #24
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,373

    Re: SUMPRODUCT & Time (cells containing formula)

    Maybe like this?


    Azumi
    Attached Files Attached Files

  25. #25
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Azumi,

    Thank you for the input. the end result is more of number of occurrences in a time , date, group membership and specific employees. Much thanks


    dredwolf,

    You are correct, It seems to be using to what excel says it's a compatible mode. I am now saving it to .xlsx instead of .xls to avoid issues.


    Tony,

    Formula did not give me an error msg but gave me a result of " 0 " on my worksheet. On the one I submitted worked.

    =SUM(IF(FREQUENCY(IF(TEXT(L5:L35874,"m/d/yyyy h")=TEXT(T5+U5,"d/m/yyyy h"),IF(O5:O35874=V5,IF(ISNUMBER(MATCH(Q5:Q35874,S5:S45,0)),MATCH(Q5:Q35874,Q5:Q35874,0)))),ROW(Q5:Q35874)-ROW(Q5)+1),1))


    L5:L35874 = Time column

    O5:O35874 = column contains service_desk amount others

    Q5:Q35874 = column containing employees

    S column = Has the list of employee that we are interested in.



    ******This is such a cliffhanger moment********
    Last edited by rogrand; 11-11-2013 at 12:41 AM.

  26. #26
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    IF(TEXT(L5:L35874,"m/d/yyyy h")=TEXT(T5+U5,"d/m/yyyy h")
    The text formats are not the same.

  27. #27
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Hey Tony,

    I fixed the suggusted syntx. Still will only show " 0 " as a result.

    Here is a sample with only 9 rows and with your two formulas and expected results at the end. Should be 1. Its saved in the format I am useing.

    Hope this helps finding out the issue.
    Attached Files Attached Files
    Last edited by rogrand; 11-11-2013 at 02:41 PM.

  28. #28
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    Made slight tweaks to Formula 1 and the correct result is still 0.

    Array entered**:

    =SUM(IF(FREQUENCY(IF(TEXT(K2:K9,"m/d/yyyy h")=TEXT(S2+T2,"m/d/yyyy h"),IF(N2:N9=U2,IF(ISNUMBER(MATCH(P2:P9,R2:R9,0)),MATCH(P2:P9,P2:P9,0)))),ROW(P2:P9)-ROW(P2)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    In the data there is a single row that ALMOST meets all the conditions.

    Row 8:

    K8: 10/1/2013 1:27:52 AM (meets the date and time criteria)
    N8: service_desk (meets the group criteria)
    P8: David S Anderson - does not meet the employee criteria

    David S Anderson is not in the list of employees in R2:R9

    So, the formula is returning the correct result of 0.

    If I add David S Anderson to the employee list in R2:R9 then both formulas return the correct result of 1.

  29. #29
    Forum Contributor
    Join Date
    09-15-2005
    Location
    Florida
    MS-Off Ver
    Excel Professional Plus 2016
    Posts
    143

    Re: SUMPRODUCT & Time (cells containing formula)

    Tony, dredwold and Azumi,

    I can not express my gratitud. Tony thank you for sticking it out. I would never, with the resarch spent on the web, could have done it alone. Now I can spend family time and have that peace of mind that this is over.. Good thing you can't see my tears of joy through the pc.

    Please let me know if the forum excepts donations.

    Cordially

    Robert

  30. #30
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: SUMPRODUCT & Time (cells containing formula)

    I knew we would eventually arrive at a solution!

    You're welcome. 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. Ignore Blank Cells in SUMPRODUCT formula
    By taniwha in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-22-2013, 10:52 AM
  2. Replies: 5
    Last Post: 04-18-2013, 11:31 AM
  3. Help with SUMIFS/SUMPRODUCT Formula? for date/time
    By auswtz in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-31-2013, 09:47 AM
  4. Excel 2007 : SUMPRODUCT formula and blank cells
    By antispam246 in forum Excel General
    Replies: 4
    Last Post: 12-31-2009, 12:48 PM
  5. Selecting Cells With Sumproduct Formula, Then Pasting Its Value Over Top
    By Carroll in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2005, 02:05 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