+ Reply to Thread
Results 1 to 13 of 13

Index match with time variables

  1. #1
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Index match with time variables

    I need to pull data out of a data set for an individuals work day. To do this I am using an index match formula but I am having issues with the result. The data for the individual is one work day but since they start work at 1:30 in the afternoon and does not finish some days until after midnight the formula can not pull the correct data since it is splitting time into two work days. How can I adjust my formula so that it pulls the entire work day? Please see the example.
    Attached Files Attached Files
    Last edited by chriswrcg; 07-24-2021 at 09:38 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Sorting issue

    Administrative Note:

    We would very much like to help you with your query, however the thread title does not really convey what your request is about. Tell us what you are trying to do, with more detail, in your title.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: Sorting issue

    in O2 copy down
    =IF(D1>D2,D1+1,D2)-D1
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  4. #4
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: Sorting issue

    Quote Originally Posted by torachan View Post
    in O2 copy down
    I don't think this is solving my problem. It's just another way to do the math if I am not mistaken. I need to be able to tell the system I only want to see the results between two time variables that happen to be from separate days. "If Name equals this and date equals this and starting time is greater than this and ending time is less than this then return this value" I got the name and the date part I just need to add the greater than "this" time variable and less than "this" time variable part of it.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Index match with time variables

    What are the start and end times you wish to use?

  6. #6
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: Index match with time variables

    Quote Originally Posted by AliGW View Post
    What are the start and end times you wish to use?
    If you look at the example, Day one starts with time stamp 15:27:11 on 7/21/2021 and ends at 00:18:05 on 07/22/2021.
    Day two starts at 15:38:05 07/22/2021 and ends on 00:19:19 07/23/2021.
    Even though the "work day" is two days per the calendar I need the system to see it as one day. If possible

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Index match with time variables

    That doesn't answer my question.

    What is the EARLIEST time someone can start a working day? Is it 13:30?
    Last edited by AliGW; 07-24-2021 at 11:08 AM.

  8. #8
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: Index match with time variables

    Yes on most days. for second shift. I'm sorry this is confusing.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Index match with time variables

    See if this gets you any closer:

    =IFERROR(@INDEX(Data!$O$2:$O$1034921,AGGREGATE(15,6,ROW($1:$1032996)/((Data!$A$2:$A$1034921=$A$1)*(Data!$L$2:$L$1034921+Data!$D$2:$D$1034921>=C$2)*(Data!$L$2:$L$1034921+Data!$D$2:$D$1034921<C$2+1.5625)),@ROW(1:1))),"")
    Last edited by AliGW; 07-24-2021 at 11:20 AM. Reason: Typo

  10. #10
    Forum Contributor
    Join Date
    04-04-2016
    Location
    dallas tx
    MS-Off Ver
    365 (15.0.5501.1000)
    Posts
    534

    Re: Index match with time variables

    I think that is working. I am getting some weird gap times but that is the system trying to calculate between 23:58:10 and 00:04:14. I would get a more accurate result if I convert the latter to 24:04:14 but I can do that with a search and replace. Thanks for all the help.
    Last edited by AliGW; 07-24-2021 at 11:42 AM. Reason: PLEASE don't quote unnecessarily!

  11. #11
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,303

    Re: Index match with time variables

    @chriswrcg, your original formula was merely showing the time difference between the preceeding time in the same column (=D2-D1)
    This was falling over on the cases that went over midnight - all my formula did was cater for this case - did you even try - you would then see it works.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,728

    Re: Index match with time variables

    No worries. You may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  13. #13
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: Index match with time variables

    Try in O2; Drag down.

    Please Login or Register  to view this content.
    Last edited by Croweater; 07-24-2021 at 07:21 PM.

+ 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] A Sorting Issue
    By vichisov in forum Excel General
    Replies: 11
    Last Post: 11-14-2013, 10:22 AM
  2. Sorting Issue
    By letangerang58 in forum Excel General
    Replies: 1
    Last Post: 05-06-2013, 12:54 PM
  3. Sorting Issue
    By clundeen in forum Excel General
    Replies: 5
    Last Post: 01-18-2011, 09:10 AM
  4. Sorting Issue
    By tdurton in forum Excel General
    Replies: 6
    Last Post: 06-10-2009, 04:04 PM
  5. sorting issue
    By gfrantsen1961 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-06-2007, 08:33 AM
  6. [SOLVED] Sorting issue
    By Sige in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-10-2006, 11:20 AM
  7. Sorting Issue. Please help
    By V-ger in forum Excel General
    Replies: 17
    Last Post: 11-14-2005, 08:35 PM
  8. Sorting Issue
    By Sean DeBruler in forum Excel General
    Replies: 4
    Last Post: 11-10-2005, 03:10 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