+ Reply to Thread
Results 1 to 9 of 9

return oldest date based on call value

  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    return oldest date based on call value

    I have 4 columns (Date (A), Open (B), High (C), Low (D)) in date order with the newest at the top. I have a value in G1, I'd like to see the oldest date returned in H1 of when a value in the (D) column is lower then G1. I've been looking at match and vlookup but what I can't seem to figure out is how to return the oldest date. Thank you for the help.

  2. #2
    Forum Contributor
    Join Date
    12-09-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    171

    Re: return oldest date based on call value

    Could you please upload a sample workbook with required output
    Like my answer, then click * below

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: return oldest date based on call value

    Maybe:
    =LOOKUP(2,1/($D$2:$D$10<$G$1),$A$2:$A$10)
    Quang PT

  4. #4
    Registered User
    Join Date
    03-21-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: return oldest date based on call value

    Quote Originally Posted by satabp View Post
    Could you please upload a sample workbook with required output
    date.xlsx

    Thank you.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: return oldest date based on call value

    Formula in my previous post to adapt your range:

    In H2:

    =LOOKUP(2,1/($D$2:$D$297<=$G2),$A$2:$A$297)

    H3:
    =LOOKUP(2,1/($C$2:$C$297>=$G3),$A$2:$A$297)

  6. #6
    Registered User
    Join Date
    03-21-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: return oldest date based on call value

    Quote Originally Posted by bebo021999 View Post
    Formula in my previous post to adapt your range:

    In H2:

    =LOOKUP(2,1/($D$2:$D$297<=$G2),$A$2:$A$297)

    H3:
    =LOOKUP(2,1/($C$2:$C$297>=$G3),$A$2:$A$297)
    Awesome, thank you very much. Curious though, what in the formula is telling it to start looking from the bottom (oldest first) instead of the top (newest first)?

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: return oldest date based on call value

    Nice to hear it work!

    LOOKUP is a function that can looks for exactly ( or nearly) data in range 1 and returns corresponding data in range 2.

    range 1 = 1/($D$2:$D$297<=$G2) return 1 where equals G2, else ERROR : {!DIV/0;!DIV/0;....;1;1;!DIV/0}

    assuming range 2 = {date 1; date 2;....;date 99; date 100; date n}

    =LOOKUP(2,1/($D$2:$D$297<=$G2),$A$2:$A$297)

    look up number "2" (or others that greater than 1) in range 1, find the nearest value from the bottom ( that is last

    number "1"), then returns coresponding date in range 2 (that is date 100)

    Hope it helps much!

  8. #8
    Registered User
    Join Date
    03-21-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: return oldest date based on call value

    Quote Originally Posted by bebo021999 View Post
    Nice to hear it work!

    LOOKUP is a function that can looks for exactly ( or nearly) data in range 1 and returns corresponding data in range 2.

    range 1 = 1/($D$2:$D$297<=$G2) return 1 where equals G2, else ERROR : {!DIV/0;!DIV/0;....;1;1;!DIV/0}

    assuming range 2 = {date 1; date 2;....;date 99; date 100; date n}

    =LOOKUP(2,1/($D$2:$D$297<=$G2),$A$2:$A$297)

    look up number "2" (or others that greater than 1) in range 1, find the nearest value from the bottom ( that is last

    number "1"), then returns coresponding date in range 2 (that is date 100)

    Hope it helps much!
    Cool, I do understand some, but what I don't get is how does it know to find the nearest value from the bottom and not the top?

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: return oldest date based on call value

    look up number "2" (or others that greater than 1) in range 1, find the nearest value from the bottom ( that is last

    number "1")
    This is how LOOKUP did: find the exact or approximate match to value. The lookup_range must be sorted in accending order

    LOOKUP(5,{1,2,3,4,5,6},{"A","B","C","D","E","F"}) = "E" : find exactly

    LOOKUP(5,{1,2,3,4,5,5},{"A","B","C","D","E","F"}) = "F" : find exactly to last match in range

    LOOKUP(6,{1,2,3,4,5,5},{"A","B","C","D","E","F"}) = "F" : find last approximate match

    LOOKUP(5,{1,1,1,1,1,1},{"A","B","C","D","E","F"}) = "F" : find last approximate match

    LOOKUP(2,{1,1,1,1,1,1},{"A","B","C","D","E","F"}) = "F" : find last approximate match

    LOOKUP(2,{1/0,1,1,1,1/0,1/0},{"A","B","C","D","E","F"}) = "D" : find last approximate match

    Hope this helps.

+ 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. Select the oldest date of based on "P" in another column
    By MarioBotelho in forum Excel General
    Replies: 5
    Last Post: 08-17-2011, 10:37 AM
  2. Display value based on oldest date and other criteria.
    By Permagrin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2009, 09:48 AM
  3. Lookup Adjacent Cell Values based on Newest and Oldest Date
    By nevi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2008, 02:27 PM
  4. Help: Need to find oldest date based on a location
    By paindivine in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-11-2006, 03:14 PM
  5. formula help to get oldest date in column based off another parameter
    By slimswol in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2006, 10:52 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