+ Reply to Thread
Results 1 to 5 of 5

Last entry in a colum that matches a certain value

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Cork, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Last entry in a colum that matches a certain value

    Hi,

    I am a newbie here so apologies if this is a stoopid question. I have searched far and wide and gotten nowhere.

    I have a worksheet that looks like this...
    Column A Column B
    1 1/1/2009
    2 2/3/2009
    3 4/4/2009
    1 12/5/2009
    3 10/6/2009
    ... ...

    Column A can have values 1-9 but the last entry of each number is the last time it was used (the entry in col B is the date) I want to create a summary sheet that lists 1-9 and the last date it was used next to it.

    Column A Column B
    1 12/5/2009
    2 2/3/2009
    3 10/6/2009
    ... ...

    LOOKUP won't work because col 1 isn't sorted. I 'feel' it is possible with a combination of lookup,index or match using the Column A value in the new sheet and the colums in the original sheet, but I just can't solve it.

    Any help please??

    Thanks,

    Liam.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446

    Re: Last entry in a colum that matches a certain value

    I feel there's a simpler way, but this array (confirm with CTRL, SHIFT and ENTER) will do it:

    =INDEX(B1:B20,MAX(ROW($1:$20)*(A1:A20=1)))

    where you're looking for the last occurrence of 1.

    Adjust ranges and the row limits to suit your data.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Last entry in a colum that matches a certain value

    =MAX(IF($A$1:$A$100=3,$B$1:$B$100)) array entered with ctrl+shift+enter will do it
    Last edited by martindwilson; 11-10-2009 at 08:57 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Last entry in a colum that matches a certain value

    You can still use LOOKUP if you say the last entry is the last time it was used (ie data is sorted by date Ascending)

    Summary
    B1: =LOOKUP(2,1/(Sheet1!$A$1:$A$100=$A1),Sheet1!$B$1:$B$100)
    copied down for remaining values

    Other alternatives...

    MAX Array (given dates)
    B1: =MAX(IF(Sheet1!$A$1:$A$100=$A1,Sheet1!$B$1:$B$100))
    confirmed with CTRL + SHIFT + ENTER

    Pivot Table
    Set Column A as Row Field and B as Data Field set to MAX.

  5. #5
    Registered User
    Join Date
    11-10-2009
    Location
    Cork, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Last entry in a colum that matches a certain value

    Sweeps solution worked perectly!!

    Thanks!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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