+ Reply to Thread
Results 1 to 17 of 17

Count occurances where Deliveries were early or on time as compared to scheduled

  1. #1
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Count occurances where Deliveries were early or on time as compared to scheduled

    Hello,

    I am brand new to the forum and in need of help.

    I have a set of data I need to count.
    The data consists of 2 columns essentially, Scheduled Delivery Date and Actual Delivery Date.
    If the Delivery was made on time or early, I want to count it. I will do a similar count for Late as well.
    Additionally, the user can enter the Scheduled date range they want to count early/on time deliveries from. There all also blanks in the Actual Delivery date column where deliveries have not been made (no actual).

    Cells O3:O38 contain the Actual dates
    Cells N3:38 contain the Scheduled dates
    Cell B3 contains the begin date to start the range.
    Cell B4 contains the end date of the range.

    I have tried using COUNTIFS and am having trouble getting the formula to work.

    I tried:
    =COUNTIFS(O3:O38,O3:38<=N3:38,N3:N38 ,>=$B$3,N3;N38<=$B$4)

    I know this will not work but I hope it shows the logic I want.
    Count range O3:O38 where values in O3:O38 are less than or equal to the corresponding cell value in N3:N38, for a range of N3:N38 that is greater than or equal to the date in B3 and less than or equal to the date in B4.

    Thank you very much in advance for your help.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    You might be able to simplify this by having an additional column which has the actual date minus the scheduled date. You can then count negative/positive numbers in this column where the actual dates are within your range.
    Martin

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

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

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

    SMALL = 20 rows worth of data is plenty.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    Thanks.
    Adding a column may be an option but it is not preferred. We considered adding an Early/On time column and using and IF(O3<=N3, "Y",IF(O3>N3,"N","")) and then counting "Y"s by the restricted date range.
    This would require creating a complete dummy worksheet since the data range set worksheet has ties to other users and adding columns to it is not an option.
    I am hoping there is a way the ranges can be compared as arrays in the criteria argument section.

  5. #5
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    Attached is a sample spreadsheet.
    The Early/On Time (Cell E12) and Late (Cell E13) are the ones I am trying to display count occurrences in.
    the plan date range is A10:A27 and the Actual date range is B10:B27.
    the date restriction range is set by inputting the Work Week number in Cell B2. Start date range is then B3 and end date range B4.
    If shown how I am counting Plan and Actual occurrences, it is the addition of Early/On time and Late comparison of ranges that is giving me struggles
    Early-On Time test.xlsx

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

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    You didn't include the expected results.

    I'm not sure what you're wanting to count so I need to know what results you expect so I can figure it out.

    How about this...

    Repost the file and manually enter the results you expect. Color code the data that falls into the 2 categories.

  7. #7
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    thanks
    I have updated the attached and color coded to show the Plan range I'm looking at in green (between 8/1/14 and 8/15/14), the number of Actual occurrences that are less than or equal to corresponding Plan dates in blue and the number that are greater than in red.

    Early-On Time test.xlsx
    Last edited by GAVEL; 08-17-2014 at 09:01 PM.

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

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    Why is row 18 counted as late?

    Both the Plan date and the Actual date are within the Begin-End date range.

  9. #9
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled


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

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    Try these...

    Early/On time

    =COUNTIFS(A10:A27,">="&B3,B10:B27,"<="&B4)

    Late

    =COUNTIFS(A10:A27,">="&B3,B10:B27,">"&B4)

  11. #11
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    that's not what I'm looking for though.
    I need cells in B10:B27 compared to the corresponding values in cells A10:A27 for a range that is restricted to A10:A27 ">="B3 and "<=" B4.
    Cell B18 is shaded red in the example not because it is greater than cell B4 but because it is greater than cell A18.
    Cells B11, B15, B16, B17 and B19 are shaded blue because they are <= cells A11, A15, A16, A17 and A19.

    the date range array is defined by cells in A10:A27 being >= B3 and <=B4. Those cells are shaded green. The countifs is counting cells in range B10:B27 that correspond the A10:A27 cells shaded green and comparing the B10:B27 value to the A10:A27 (Blue if <= and Red if >=)

  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: Count occurances where Deliveries were early or on time as compared to scheduled

    Quote Originally Posted by GAVEL View Post
    Cells B11, B15, B16, B17 and B19 are shaded blue because they are <= cells A11, A15, A16, A17 and A19.
    Row 16... Actual is greater than Plan

    (Blue if <= and Red if >=)
    You can't have those conditions as they overlap. When the Plan and Actual are equal they will be double counted.

    I think you probably want:

    Early/On Time = less than or equal to
    Late = greater than

    Try these...

    Early/On Time:

    =SUMPRODUCT(--(A10:A27>=B3),--(B10:B27<=B4),--(B10:B27<>""),--(B10:B27<=B4))

    Result = 5

    Late:

    =SUMPRODUCT(--(A10:A27>=B3),--(B10:B27<=B4),--(B10:B27>A10:A27))

    Result = 1
    Last edited by Tony Valko; 08-18-2014 at 09:03 AM.

  13. #13
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    I don't understand why you are comparing cell B10:B27 to cell B4 (B10:B27<=B4) in the equation above.
    dates in cell range B10:B27 are considered Early/On Time if they are less or equal to the Plan date in Cells A10:A27 (and late if they are>)
    Cells B3 and B4 are only used to define the range of Plan dates (Cells A10:A27) you want to look at.

  14. #14
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    I think what you've given me is correct if I just make the B10:B27 range comparison to <= A10:A27 in the last array.
    Last edited by GAVEL; 08-18-2014 at 09:25 AM.

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

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    Apparently I don't understand what you want to do.

    Maybe a fresh set of eyes will be able to see what I can not see.

    Let me see if I can call in some more help.

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

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    I think Tony has almost got you there - I assume you want these two formulas

    =SUMPRODUCT(--(A10:A27>=B3),--(A10:A27<=B4),--(A10:A27<=B10:B27))

    and

    =SUMPRODUCT(--(A10:A27>=B3),--(A10:A27<=B4),--(A10:A27>B10:B27))
    Audere est facere

  17. #17
    Registered User
    Join Date
    08-17-2014
    Location
    Tempe, AZ
    MS-Off Ver
    2013
    Posts
    9

    Re: Count occurances where Deliveries were early or on time as compared to scheduled

    That appears to be working! The last expression just needs to be reversed; it should be: --(B10:B27<=A10:A27)
    I also added in the --(B10:B27<>"") so there are no inadvertant blank counts.

    Thank you so much!

+ 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] How to count occurances from date time format?
    By Smudge.Smith in forum Excel General
    Replies: 3
    Last Post: 06-26-2014, 10:42 AM
  2. [SOLVED] IF function: Early/On Time/Late Time vs. set window of time
    By hclark579 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2014, 05:37 PM
  3. Need to Count Occurances over Time Range in a Night Shift
    By lmbrown2008 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2013, 06:54 PM
  4. [SOLVED] Count # of occurances based on time of day.
    By wstern in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-16-2012, 10:58 AM
  5. Replies: 5
    Last Post: 05-11-2012, 03:38 AM

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