+ Reply to Thread
Results 1 to 8 of 8

How to find the last matching value or before the last one?

  1. #1
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Question How to find the last matching value or before the last one?

    Hello All

    I have some items in A:A range and a Date in B:B Range
    Some items are repeated for example Eggs, Bread…etc.
    In cell M1 I want to find the last matching value (which I put in cell L1 – for example I put Eggs)
    And how to find the date related to last matching value (eggs) and to put the date in Cell N1.

    Another question: what I need to change in the formula given to find the value before the last (if I put the same item eggs) and its related date.
    Example:
    A1 B1
    1 Eggs 12/3/2016
    1 Bread 15/3/2016
    1 Eggs 17/3/2016
    1 Fish 18/3/2016
    1 Eggs 19/3/2016
    1 Fish 19/3/2016
    -------------------------------
    The answer will be:
    Last value (for eggs) =
    A1 B1
    Eggs 19/3/2016
    -------------------------------
    Value before the last (for eggs) =
    A1 B1
    1 Eggs 17/3/2016
    -------------------------------

    I hope it is clear

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to find the last matching value or before the last one?

    Try this...

    Data Range
    A
    B
    C
    D
    E
    1
    Eggs
    3/12/2016
    Eggs
    3/19/2016
    2
    Bread
    3/15/2016
    3/17/2016
    3
    Eggs
    3/17/2016
    4
    Fish
    3/18/2016
    5
    Eggs
    3/19/2016
    6
    Fish
    3/19/2016
    7
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in E1:

    =IFERROR(LARGE(IF(A$1:A$6=D$1,B$1:B$6),ROWS(E$1:E1)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Format as Date

    Copy down to E2
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Re: How to find the last matching value or before the last one?

    Thank you Tony Valko

    I try it but it is not working even I Hold down both the CTRL key and the SHIFT key
    then hit ENTER but no result shown

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to find the last matching value or before the last one?

    enter this into M1 using ctrl shift enter.

    It will find the last but one occurrence.

    To find the last occurrance change the 2 to a one.

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  5. #5
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Re: How to find the last matching value or before the last one?

    Thank you mehmetcik

    it is working

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to find the last matching value or before the last one?

    Here's a sample file that demonstrates this.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-13-2016
    Location
    Yemen
    MS-Off Ver
    2016
    Posts
    59

    Re: How to find the last matching value or before the last one?

    thank you Tony Valko, I really appreciate your help and support

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to find the last matching value or before the last one?

    You're welcome!

+ 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: 2
    Last Post: 04-11-2013, 11:14 AM
  2. [SOLVED] Find matching data..
    By Viv808 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-03-2013, 09:43 PM
  3. [SOLVED] Find matching words in 10 columns and add row numbers of matching words
    By zeke 29 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-03-2012, 09:57 AM
  4. [SOLVED] Find matching rows
    By Oeysbrei in forum Excel General
    Replies: 5
    Last Post: 04-21-2012, 05:58 AM
  5. Replies: 1
    Last Post: 07-25-2011, 01:07 PM
  6. Find Matching Value
    By infinitysales in forum Excel General
    Replies: 2
    Last Post: 09-18-2009, 02:39 PM
  7. Find Matching entries
    By PhilH1982 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-14-2007, 09:52 AM
  8. [SOLVED] Find rows matching Max value
    By Serena in forum Excel General
    Replies: 3
    Last Post: 07-18-2006, 09:45 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