+ Reply to Thread
Results 1 to 6 of 6

Select the oldest date of based on "P" in another column

  1. #1
    Registered User
    Join Date
    08-17-2011
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Select the oldest date of based on "P" in another column

    Hello!!!

    I need some help to solve this problem:

    I want the date associate to the first P value... But i can gat it with Vlookup cus to use this function the values of AY colum must be organized ascendenting... And even if i organize, we obtain the most recent date and no the oldest.

    Please someone, take a look and save me
    Attached Images Attached Images
    Last edited by MarioBotelho; 08-17-2011 at 10:37 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: I try to have the oldest date of "P", but i can't ... :(

    Try:

    =INDEX(AZ2:AZ100,MATCH(TRUE,INDEX(AY2:AY100="P",0),0))

    adjust ranges to suit.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Select the oldest date of based on "P" in another column

    1. VLOOKUPs do not necessarily need to be sorted in accending order. If you add a fourth argument of FALSE, it will continue to look until it finds an exact match (i.e. =VLOOKUP(A1, $B$1:$C$50,2, FALSE) )

    2. I'd use INDEX, MATCH and MIN for this issue
    =INDEX($AY$2:$AY$1000, MATCH(MIN($AZ$2:$AZ$1000),$AZ$2:$AZ$1000,0))
    Does that work for you?

    EDIT: As per NBVC, I forgot to take into account "P" and was looking for first date as in minimum and not in order.

    =INDEX($AZ$2:$AZ$1000, MATCH("P",$AY$2:$AY$1000,0))
    Last edited by ChemistB; 08-17-2011 at 09:39 AM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    08-17-2011
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Select the oldest date of based on "P" in another column

    I should have done something wrong...

    I after change the values of AY2 and AZ1000 and still happening the same error...
    Attached Images Attached Images

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Select the oldest date of based on "P" in another column

    That formula won't find the first P date.

    Try either my formula or ChemistB's better last formula:

    =INDEX($AZ$2:$AZ$1000, MATCH("P",$AY$2:$AY$1000,0))

    you may need to change the commas to semi-colons for your regional settings

    =INDEX($AZ$2:$AZ$1000; MATCH("P";$AY$2:$AY$1000;0))

  6. #6
    Registered User
    Join Date
    08-17-2011
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Select the oldest date of based on "P" in another column

    Amazing... Thank you very much.

    If you have some time, send me a PM to tell me how can i improve my skills in Excel...

+ 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