+ Reply to Thread
Results 1 to 10 of 10

Finding the last occurrence of a value in a list

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    Portland OR
    MS-Off Ver
    Excel 2007
    Posts
    10

    Question Finding the last occurrence of a value in a list

    I have an action log that tracks my physical inventory by serial number, so one serial number could appear in multiple times in the list.

    On a separate table, I want to be able to parse this list and show only the last action taken based no the serial number. I can assume the action list will be sorted by date.

    This may not matter, but I do need to keep this file in .xls format, as I have a Python script that may need to read this file later on and extract data, and maybe even write to it.

    I have attached a sample showing a mockup of the action log, the desired results, and my few attempts at solving the problem.

    So far, I've had no luck. Could someone tell me how to do this or throw some advice my way?

    Thanks,

    JoshLookup.xls

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Finding the last occurrence of a value in a list

    In F3 and copy down,

    =LOOKUP(2, 1/($B$3:$B$6=E3), $C$3:$C$6)
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    05-29-2012
    Location
    Portland OR
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the last occurrence of a value in a list

    Wow.

    Simply, Wow. Thank you.

    This doesn't look anything like the documentation.

    I gather the 1/($B$3:$B$6=E3) is doing the job of reversing the array and doing the check? If so, what purpose does the 2 serve?

  4. #4
    Registered User
    Join Date
    10-10-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003, 2007 & 2010
    Posts
    88

    Re: Finding the last occurrence of a value in a list

    Hi Josh, I've placed a solution in a copy of your original spreadsheet.

    121109 - Lookup Last Occurrence.xls

  5. #5
    Registered User
    Join Date
    10-10-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003, 2007 & 2010
    Posts
    88

    Re: Finding the last occurrence of a value in a list

    Oops...pipped to the post! ;-)

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Finding the last occurrence of a value in a list

    Hi Josh,

    See if this helps.
    HTH
    Regards, Jeff

  7. #7
    Registered User
    Join Date
    05-29-2012
    Location
    Portland OR
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the last occurrence of a value in a list

    Quote Originally Posted by Sofistikat View Post
    Oops...pipped to the post! ;-)
    Is that an Australian phrase or an ExcelForum phrase? I've never heard of it.

    I'm trying to figure this one out. I don't get what the equation is actually doing. THat is, I don't get the what the input to this equation is doing. B3:B6=E3 returns a boolean value, so 1/1 = 1 or 1/0 = Error. I suppose the 2 provides an upper limit, but how that identifies the last True value, I don't know.

  8. #8
    Registered User
    Join Date
    05-29-2012
    Location
    Portland OR
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Finding the last occurrence of a value in a list

    Quote Originally Posted by jeffreybrown View Post
    Hi Josh,

    See if this helps.
    Yup. That helps a lot.

    Thanks.

  9. #9
    Registered User
    Join Date
    10-10-2010
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003, 2007 & 2010
    Posts
    88

    Re: Finding the last occurrence of a value in a list

    Quote Originally Posted by _Josh_ View Post
    Is that an Australian phrase or an ExcelForum phrase? I've never heard of it.
    The Queen's English, I believe :-)

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Finding the last occurrence of a value in a list

    yup, definitely queens english from a horse-racing term
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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