+ Reply to Thread
Results 1 to 15 of 15

Can you find a value in a list between two values

  1. #1
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Can you find a value in a list between two values

    I have a list of dates and want to return a date which falls between two dates.
    I have tried to use a VLOOKUP formula but can't seem to get it to work. Is there a way of doing this??

    Thank you

  2. #2
    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: Can you find a value in a list between two values

    Can you clarify a little more pls?
    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.

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: Can you find a value in a list between two values

    And perhaps post a small sample sheet?

  4. #4
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Can you find a value in a list between two values

    Yes.

    I have a list of training dates of one worksheet then I need to return one of those dates which falls between two dates in another sheet.

    So i.e.

    A1:A10 has a number of dates in it.

    In B1 I have one date and in C1 another date

    In D1 i want to find a date in the list A1:10 that falls between B1 and C1

  5. #5
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Can you find a value in a list between two values

    Trying to upload something but computer at work being a bit on the slow side!

  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: Can you find a value in a list between two values

    You are looking for JUST one date OR is possible to exist many dates as result?

  7. #7
    Registered User
    Join Date
    09-09-2011
    Location
    kuching, Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: Can you find a value in a list between two values

    Perhaps you can use the "Filter" function to find the result. Just my suggestion.

  8. #8
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Can you find a value in a list between two values

    Fotis1991: I am looking to return just one date but there may be more than one date with in the range
    nickh1981: Not heard of the Filter function will look into that

    Thank you

  9. #9
    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: Can you find a value in a list between two values

    Quote Originally Posted by nappy1001 View Post
    Fotis1991: I am looking to return just one date but there may be more than one date with in the range

    Thank you
    And in this case which date do you want to return?

    Can you pls post a small sample workbook?

  10. #10
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Can you find a value in a list between two values

    Really sorry but still struggling to attach a file. Think its my work computer....
    To answer the question though it really doesnt matter which date it returns as long as it falls between the two dates specified.

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,515

    Re: Can you find a value in a list between two values

    Is the list of dates in A1:A10 sorted?
    Is the list of dates in A1:A10 date serial values or are they text strings that represent dates?
    Since you have been unable to attach a sample file, these are questions that only you can answer.

    If the list contains date serials and they are sorted in ascending order, you may be able to use the vlookup() (or other lookup function) to do this. Note that, when the fourth argument is true or omitted, vlookup will return the entry that is just smaller than lookup_value. So, if you put the larger/later of the two dates into a vlookup() function, it will return the value that is just smaller than the later date. Which, assuming that this value is also larger than the smaller date, should be a correct return value.

    If the dates are input as text strings, this will not work, because the text string sort order will be different (alphabetical rather than date). In this case, I think I might work on getting the text strings converted to date values.
    Attached Files Attached Files
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  12. #12
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Can you find a value in a list between two values

    That is brilliant I think and I think this does solve my problem. To answer your question in the attachment I think i could write an If statement to say if the vlookup isn't between two dates then dont return a value if it does then return a vaule.

    Thank you

  13. #13
    Registered User
    Join Date
    09-12-2013
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Can you find a value in a list between two values

    Have tried a number of ways to sort this. Still can't attach any files and explorer crashes when I try!!

    I have tried this formula where i have a list of dates in a2:a8 and two dates in c1,b1 for the date to be between but it doesnt work!!

    if median(vlookup(C1,A2:A8,1)),C1,B1,vlookup(C1,A2:A8,1),no

  14. #14
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,515

    Re: Can you find a value in a list between two values

    It might be hard for us to help you debug this when it appears that the pasted version of the formula is missing parantheses. I mention that because one of the first things I look at with multiple nested functions like this is to make sure the parantheses are all matched up where they should be. Are you certain the parantheses for the median function are correctly placed? As written, it appears that it is taking the median of only one value, which would make the median function superfluous.

    One suggestion: Use the "formula evaluation" tool (http://office.microsoft.com/en-us/ex...932.aspx?CTT=1 click on "evaluate a nested formula one step at a time"). This will allow you to follow the steps Excel is taking to evaluate the formula so you can see which steps are working the way you expect them to work, and which step is returning incorrect results.

  15. #15
    Forum Contributor
    Join Date
    07-16-2008
    Location
    USA
    Posts
    142

    Re: Can you find a value in a list between two values

    Sounds fairly simple. I don't think you need a vlookup, add this formula to cell D1 and copy it down, it should give you what you are looking for:

    =IF(AND(A1>$B$1,A1<$C$1),A1,0)
    OR
    =IF(AND(A1>=$B$1,A1<=$C$1),A1,0)

    This assumes that column B is earlier date and C is the latter date of the date range.
    Last edited by mcmuney; 10-04-2013 at 04:12 PM.

+ 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. Find all values and list
    By Zsoup in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-22-2013, 11:54 AM
  2. Find missing values - based on looking up a list, comparing against index values
    By anakaine in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-22-2013, 01:31 AM
  3. Excel 2007 : Find Values in two list
    By rufolate in forum Excel General
    Replies: 4
    Last Post: 03-14-2011, 02:32 PM
  4. Replies: 8
    Last Post: 12-08-2008, 12:54 PM
  5. list all the find values
    By jhahes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-15-2006, 10:20 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