+ Reply to Thread
Results 1 to 5 of 5

Lookup the most recent occurance of an input, and the return the value from another column

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Lookup the most recent occurance of an input, and the return the value from another column

    Hi All,

    Please see the attached example....


    Column A has a line number.

    Column B has dates and there are duplicates.

    Column C is the lookup value.

    Column D is the value to return.


    I want to return the value in column D, where column C has the most recent occurrence of something, I have just used a 1 letter text example 'A'.

    This should take into account both the date and the line number. Where there are multiples of 'A' entered into column C for the same date, I want to find the lowest one down in the list by line number, and then return the value in column D.


    Many thanks in advance for any insight,
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2015
    Location
    Uvalde, TX
    MS-Off Ver
    2010
    Posts
    720

    Re: Lookup the most recent occurance of an input, and the return the value from another co

    Give this a try:

    =INDEX(D1:D26,MATCH(MAX(IF(C1:C26="A",A1:A26))&"A",A1:A26&C1:C26))
    It is an array formula that has to be entered with CTRL/SHIFT/ENTER.

    Cheers

  3. #3
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Re: Lookup the most recent occurance of an input, and the return the value from another co

    Thank you, yes this ideal...

    Now can we also modify this to return the value in Column D for the 'first' most recent occurrence... So the lowest line number for the most recent date?

    I have indicated what I mean on the updated example.
    Attached Files Attached Files

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Lookup the most recent occurance of an input, and the return the value from another co

    For the most recent
    Formula: copy to clipboard
    =INDEX(D2:D26,LARGE(IF(C2:C26="A",ROW(C2:C26)-1),1))

    First occurrence
    Formula: copy to clipboard
    =INDEX(D2:D26,LARGE(IF(C2:C26="A",ROW(C2:C26)-1),2))

    Both are array formulas
    **Must be entered with Ctrl+Shift+Enter key combination.
    Attached Files Attached Files
    Last edited by AlKey; 04-30-2017 at 08:08 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    191

    Re: Lookup the most recent occurance of an input, and the return the value from another co

    This is ideal, thanks both for the insight

+ 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. Replies: 13
    Last Post: 04-23-2016, 12:00 PM
  2. Replies: 2
    Last Post: 01-04-2016, 03:40 AM
  3. [SOLVED] Index an array, return most recent repair, first three letters lookup
    By Martin Chamberlin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-16-2014, 08:57 AM
  4. [SOLVED] Lookup first two letters and return the most recent data
    By Martin Chamberlin in forum Excel General
    Replies: 12
    Last Post: 05-12-2014, 02:38 AM
  5. [SOLVED] Upper Lookup finding nth occurance in a row returning value in corresponding column
    By BobTheRocker in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-11-2014, 09:36 AM
  6. [SOLVED] vba to parse a large spreadsheet and only keep the most recent occurance column b
    By john.tm in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2014, 04:51 PM
  7. Replies: 3
    Last Post: 06-06-2012, 01:44 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