+ Reply to Thread
Results 1 to 10 of 10

Index Match betwen two tables with 2nd criteria

  1. #1
    Registered User
    Join Date
    07-24-2017
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    8

    Index Match betwen two tables with 2nd criteria

    Hi All,

    Wondering if i could get your hand with a problem, ive been racking my brain trying to work out how to solve this.

    I have one table of activity with a location and start time / date and another table of location and cycle locations, number and end time (Cycle n+1 start time = cycle n = end time)

    Table 1


    Location Activity Start End Cycl Number
    9690 1 25/07/2017 10:00 25/07/2017 13:30 ?
    9465 1 25/07/2017 10:00 25/07/2017 12:00
    9690 2 25/07/2017 13:30 25/07/2017 18:00
    9690 3 25/07/2017 18:00 26/07/2017 1:00
    9465 2 25/07/2017 12:00 25/07/2017 19:00

    Table 2


    Location Cycle Number End Time
    9690 10 25/07/2017 13:00
    9690 11 25/07/2017 19:00
    9465 8 25/07/2017 11:00
    9465 9 25/07/2017 18:00


    I need to be able to some how link the activity to the cycle field such that an activity that occurs within a cycle time gets that number. so for example 9690, Activity 2 would have a cycl number 11.

    Ive tried using INDEX / MATCH array formula but so far have not had any success.

    Any help would be greatly appreciated!

    Thanks in Advance.Example.PNG

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Index Match betwen two tables with 2nd criteria

    Does the entire activity have to take place within the alloted cycle period, or do they merely have to overlap?
    For example: activity 9690.1 starts before cycle 11, but ends within it.
    Last edited by leelnich; 07-24-2017 at 09:10 PM.

  3. #3
    Registered User
    Join Date
    07-24-2017
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    8

    Re: Index Match betwen two tables with 2nd criteria

    Thanks for the super quick reply mate!

    The cycle end time will drive the activity so an activity that occurs before the cycle end time will be associated that cycle even if it continues past the end time. Capture.PNG

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Index Match betwen two tables with 2nd criteria

    So we just assume any activity that started before the end of cycle 10 is part of cycle 10, since there's no cycle 9,8,7... cutoffs? That seems pretty loose. Extending the post#3 diagram, Activity 0 is assumed to be cycle 10, even if it ended before cycle 10 began. And Activity 4 is ignored completely? Or assumed to be cycle 12?
    Last edited by leelnich; 07-24-2017 at 11:16 PM.

  5. #5
    Registered User
    Join Date
    07-24-2017
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    8

    Re: Index Match betwen two tables with 2nd criteria

    Yep that is correct, it continues going up after cycle 11 though

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Index Match betwen two tables with 2nd criteria

    OK, paste this ARRAY FORMULA* in E2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Location
    Activity
    Start
    End
    Cycle
    Location
    Cycle
    End
    2
    9690
    1
    7/25/17 10:00
    7/25/17 13:30
    10
    9690
    10
    7/25/17 13:00
    3
    9465
    1
    7/25/17 10:00
    7/25/17 12:00
    8
    9690
    11
    7/25/17 19:00
    4
    9690
    2
    7/25/17 13:30
    7/25/17 18:00
    11
    9465
    8
    7/25/17 11:00
    5
    9690
    3
    7/25/17 18:00
    7/26/17 1:00
    11
    9465
    9
    7/25/17 18:00
    6
    9465
    2
    7/25/17 12:00
    7/25/17 19:00
    9


    NOTE: This returns the first (lowest-numbered) cycle for stated location which ends AFTER the activity starts.

    *Always press CTRL+SHIFT+ENTER to confirm entry after pasting or editing an ARRAY FORMULA in the Formula Bar.
    When copying the formula to other cells, make sure the copied cell is not part of the Paste Area.


    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-25-2017 at 12:00 AM.

  7. #7
    Registered User
    Join Date
    07-24-2017
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    8

    Re: Index Match betwen two tables with 2nd criteria

    Thanks Mate! that worked a treat!

    Might be a dumb question but from what I can understand your formula works by going,

    "IF the End time is less then the cycle number and the location matches the location column then display the Cycle for that row"

    How does the formal know to grab the closes value? (i.e. what stops it say taking the time of the very first cycle)

  8. #8
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Index Match betwen two tables with 2nd criteria

    The MIN function returns the smallest NUMERIC value from an array, while ignoring BOOLEAN (true/false) values.
    So the IF clause returns a cycle NUMBER if TRUE, else it returns FALSE (because no value was specified for that part).
    Taking cell E2 as an example:
    =MIN(IF(($I$2:$I$5>C2)*($G$2:$G$5=A2),$H$2:$H$5))
    =MIN(IF({TRUE;TRUE;TRUE;TRUE}*($G$2:$G$5=A2),$H$2:$H$5))
    =MIN(IF({TRUE;TRUE;TRUE;TRUE}*{TRUE;TRUE;FALSE;FALSE},$H$2:$H$5))
    =MIN(IF({1;1;0;0},$H$2:$H$5))
    =MIN(IF({TRUE;TRUE;FALSE;FALSE},{10;11;8;9}))
    =MIN({10;11;FALSE;FALSE})
    =10

    NOTE- TRUE=1, FALSE=0 if used in math. When multiplying arrays, corresponding values are multiplied, yielding a results array of the same size.

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 07-25-2017 at 02:52 AM.

  9. #9
    Registered User
    Join Date
    07-24-2017
    Location
    Queensland, Australia
    MS-Off Ver
    2016
    Posts
    8

    Re: Index Match betwen two tables with 2nd criteria

    Thanks Mate! Appreciate the help!

  10. #10
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Index Match betwen two tables with 2nd criteria

    No worries, thank you for the rep!

+ 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] INDEX/MATCH and SUMIFS with Tables
    By phpolicylady in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-17-2017, 10:55 AM
  2. Difference between two tables using index match?
    By TheFab in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-01-2015, 09:38 AM
  3. Difference between two pivot tables with two criteria - Index/Match ?
    By TheFab in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-01-2015, 07:27 AM
  4. [SOLVED] Combining 3 Formulas: Return all Names that Match Criteria Using Index/Match
    By bchilme in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 09-29-2014, 09:28 AM
  5. Replies: 2
    Last Post: 09-27-2014, 04:34 PM
  6. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  7. Index Match Match Formula DOESN'T WORK WITH TABLES/TABLE NAMES ??
    By Underling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2014, 09:01 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