+ Reply to Thread
Results 1 to 10 of 10

retrieve value from list based on 2 criteria incl date

  1. #1
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    retrieve value from list based on 2 criteria incl date

    Hi,

    I have 2 lists. The first one is a large list (+30.000 lines) of a timesheet. This list contains the resource names, period, and actual effort.
    I want to add to each line the rol this resource has in that period. In the second list (+100 employees) I have all resources with the skill level and the first period ([yymm], e.g. 1411 is November 2014) in which the resource started in that role.

    What I am looking for is a formula that can retrieve the skill level from the second list, but also taking into account the date from which that resource has started in that role.
    For example:
    employee Anne has started working in period 1411 in role AAA and changed roles again in 1510 and 1601
    In the time sheet I have records for periods 1506, 1511, 1601 and 1602
    So when there is a record for period 1511 I would expect to show role BBB as Anne changed roles from AAA to BBB in 1510.
    See example file attached...

    I Have tried to use the vlookup, however, this does not do what I need.
    =VLOOKUP([@[Period+Name]];Table2[#All];3;TRUE)

    Is there way worksheet functions can do this?
    Attached Files Attached Files

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: retrieve value from list based on 2 criteria incl date

    Hi
    Try this
    =INDEX(Table2[Level],AGGREGATE(14,6,(Table2[Resource]=Table1[@Resource])*(Table2[Date]<=Table1[@Periode])*ROW(Table2[Column1]),1)-1)

  3. #3
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Re: retrieve value from list based on 2 criteria incl date

    Hi José, That did work on the example file I attached. Nice formula.

    However, I did not do the trick in my original file. :-(
    Maybe I over simplified the example file....
    I created a second example file by deleting worksheets and data from my original file. Hopefully this will give a better insight in what I am looking for.

    Thanks,
    Attached Files Attached Files

  4. #4
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: retrieve value from list based on 2 criteria incl date

    Hi
    Try to use
    =ÍNDICE(Table_resources[Role];AGREGAR(14;6;(Table_resources[Resource]=[@Resource])*(Table_resources[Per Datum]<=[@Period])*LIN(Table_resources[Date+Rec]);1)-1)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Please note: the formula is not an array formula, ie don´t use CSE.
    See the file Example2.xlsx

  5. #5
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Re: retrieve value from list based on 2 criteria incl date

    Hi José,
    For resource "Lenny" I see 3 lines in the Resources table. When I place a filter on the TimeSheet table for this resource I see that all lines have the same role. I would expect to see 3 different ones...

    I guess the formula should look for the first record in the Resources table that has a date not larger than the period in TimeSheet and not the first smaller than or equal to.
    Would it help to change the sort order of the Resources table to Z>A and then look for the first record which is smaller than the Period in TimeSheet?

    I like the INDEX formula, because it looks more flexible than VLOOKUP, however I do not fully understand the formula. Is the "ROW(Table_resources[Date+Rec]" part really required? What does this do?

    Cheers,
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Re: retrieve value from list based on 2 criteria incl date

    I noticed that the order of sequence for the Resources list is important. I also changed the combined field for Name and Period from Period&Name to Name&Period and then sorted the list on that Name&Period field. This way all lines for each resource are grouped together and the index formula worked better.
    I am still working on the details to have the formula match my needs for 100%

    to be continued...

  7. #7
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: retrieve value from list based on 2 criteria incl date

    Hi
    Use in column Table_TimeSheet[Period] the following formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note: [@Period]+0
    Regards
    Last edited by José Augusto; 04-04-2016 at 01:37 PM.

  8. #8
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Re: retrieve value from list based on 2 criteria incl date

    What does this +0 do?
    It did the trick, but I do not understand why...

  9. #9
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: retrieve value from list based on 2 criteria incl date

    Hi kammend
    Your column Table_TimeSheet[Period] has type text.
    to convert text to number you can use +0
    ="2345"+0 gives you 2345 as number

    Regards

  10. #10
    Registered User
    Join Date
    01-29-2013
    Location
    The Netherlands
    MS-Off Ver
    2016 x64
    Posts
    48

    Re: retrieve value from list based on 2 criteria incl date

    cool

    Regards, Daniel

+ 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. Macro end with a date criteria (incl. example file)
    By Ronnet2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2015, 04:04 PM
  2. [SOLVED] Retrieve data from a cell based on date criteria in another
    By ajob in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-23-2014, 08:49 AM
  3. [SOLVED] find missing date on every group date list based on range and criteria
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 01:26 AM
  4. VBA - Retrieve List of Available Criteria on Autofilter Columns
    By Sandheep in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-14-2012, 12:02 PM
  5. Replies: 5
    Last Post: 07-17-2012, 01:34 AM
  6. Retrieve the the value from list that meets criteria
    By ABSTRAKTUS in forum Excel General
    Replies: 12
    Last Post: 04-17-2011, 06:02 PM
  7. Count rows with multiple criteria incl max date
    By johnnyr1ngo in forum Excel General
    Replies: 3
    Last Post: 11-30-2010, 12:44 PM

Tags for this Thread

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