+ Reply to Thread
Results 1 to 6 of 6

Returning Values based on date falling between Date ranges

  1. #1
    Registered User
    Join Date
    12-22-2008
    Location
    india
    Posts
    7

    Returning Values based on date falling between Date ranges

    Attaching the sheet as I want to return the data. Please refer to the attachment as it has all required details.

    I have one date and a table with date ranges, I want to return the value from the date table which falls in between the date range.
    For further clarity on my problem, please see the attachment.

    "Needs the value appearing in column G, if the value in A5 is (less than F5, then return G5), if its equal or more than F5 but less than F6, then return G6), if its equal or more than F6 but less than F7, then return G7 ) and so on……."
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Returning Values based on date falling between Date ranges

    Hi honest1122

    Find the attached with a VLookup formula that should solve your problem. You will need real dates instead of pointers to a Z drive I don't have. See if this works for you.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Returning Values based on date falling between Date ranges

    Alternatively to Marvin's idea....

    =INDEX($G$5:$G$11,MATCH(A5,$F$5:$F$11,1))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Registered User
    Join Date
    12-22-2008
    Location
    india
    Posts
    7

    Re: Returning Values based on date falling between Date ranges

    Quote Originally Posted by MarvinP View Post
    Hi honest1122

    Find the attached with a VLookup formula that should solve your problem. You will need real dates instead of pointers to a Z drive I don't have. See if this works for you.
    Quote Originally Posted by Fotis1991 View Post
    Alternatively to Marvin's idea....

    =INDEX($G$5:$G$11,MATCH(A5,$F$5:$F$11,1))
    Thanks for your replies but both the formulas are giving me wrong values.
    Say for example, I put date as 14th July 12, I need value as 4 but with both the formulas, its coming as 3.

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Returning Values based on date falling between Date ranges

    Not sure for other dates but for your example, this formula, gives you what you ask for...

    =INDEX($G$5:$G$11,MATCH(A5,$F$5:$F$11,1)+1)

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Returning Values based on date falling between Date ranges

    Not sure for other dates but for your example, this formula, gives you what you ask for...

    =INDEX($G$5:$G$11,MATCH(A5,$F$5:$F$11,1)+1)

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Returning Values based on date falling between Date ranges

    Hi,

    On your sample worksheet you have pointers to a remote drive. Those may be TEXT instead of real Date values. Somehow you need to make them dates and not text for our formulas to work. Also - you will need to type in a date that is greater than the first date in the table for the vlookup to work. If you put in a date outside the table's range it will not give you what you want.

  8. #8
    Registered User
    Join Date
    12-22-2008
    Location
    india
    Posts
    7

    Re: Returning Values based on date falling between Date ranges

    Quote Originally Posted by Fotis1991 View Post
    Not sure for other dates but for your example, this formula, gives you what you ask for...

    =INDEX($G$5:$G$11,MATCH(A5,$F$5:$F$11,1)+1)
    Now its adding 1 to all the dates, for example, If I am putting date as 15th July, its coming as 5 whereas in the table, exact date is there as 15th July and the value should return as 4.


    What I done is that, I have updated the sheets which all possible combinations and expected values to return to it. Please have a look.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    12-22-2008
    Location
    india
    Posts
    7

    Re: Returning Values based on date falling between Date ranges

    Quote Originally Posted by MarvinP View Post
    Hi,

    On your sample worksheet you have pointers to a remote drive. Those may be TEXT instead of real Date values. Somehow you need to make them dates and not text for our formulas to work. Also - you will need to type in a date that is greater than the first date in the table for the vlookup to work. If you put in a date outside the table's range it will not give you what you want.
    Right, I have removed the link for the dates. Also its fine, if the formula return as error for dates falling outside the dates in the table. Please see my post for updated sheet with expected results for various dates.

  10. #10
    Registered User
    Join Date
    12-22-2008
    Location
    india
    Posts
    7

    Re: Returning Values based on date falling between Date ranges

    Quote Originally Posted by MarvinP View Post
    Hi,

    On your sample worksheet you have pointers to a remote drive. Those may be TEXT instead of real Date values. Somehow you need to make them dates and not text for our formulas to work. Also - you will need to type in a date that is greater than the first date in the table for the vlookup to work. If you put in a date outside the table's range it will not give you what you want.
    Right, I have removed the link for the dates. Also its fine, if the formula return as error for dates falling outside the dates in the table. Please see my post for updated sheet with expected results for various dates.

  11. #11
    Registered User
    Join Date
    12-22-2008
    Location
    india
    Posts
    7

    Re: Returning Values based on date falling between Date ranges

    Any pointers guys?

  12. #12
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Returning Values based on date falling between Date ranges

    Hi honest1122,

    I still think you want to use a VLookup function with a Range Lookup argument of TRUE. See http://www.contextures.com/xlFunctions02.html

    If this won't work for you then look for an Index Match type of formula. I thought i had solved it in an attachment above.

+ 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