+ Reply to Thread
Results 1 to 10 of 10

If statement to check if date falls between date range

  1. #1
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    If statement to check if date falls between date range

    I have the following fomula: =IF(AND(M2>i2:M2<J2),"true","false")

    The result is returning "0" and I can't figure out why. Columns I,J, and M are all in a date format.

    I am trying to figure out is M2 is betwwn i2 and j2.

  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: If statement to check if date falls between date range

    The formula you posted can not return a value of "0". When correctly written, it can only return either the text string true or false.

    As is, it will return a #VALUE! error due to a syntax error.

    Replace the colon with a comma.
    Last edited by Tony Valko; 06-21-2013 at 07:13 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If statement to check if date falls between date range

    I know, but it is returning 0. When I put it in date format it returns 1900/01/00, which is also 0.

  4. #4
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If statement to check if date falls between date range

    circular reference? It looks like it is giving me a circular reference. I made sure the dates were values and not a formula and it is still giving me a circular reference. How can this be?

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

    Re: If statement to check if date falls between date range

    Can you post a SMALL sample file that shows the formula returning a 0?

    SMALL = less than 50kb.

  6. #6
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If statement to check if date falls between date range

    Book1.xlsx

    Attached is the document.

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

    Re: If statement to check if date falls between date range

    Quote Originally Posted by mcranda View Post
    circular reference? It looks like it is giving me a circular reference. I made sure the dates were values and not a formula and it is still giving me a circular reference. How can this be?
    A circular reference means you're entering the formula in a cell that the formula references.

  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: If statement to check if date falls between date range

    The problem is that you have a syntax error in the formula.

    You're using a colon where you should be using a comma.

    Enter this formula in C2 and copy down as needed:

    =IF(COUNT(A2:B2)<2,"",IF(AND(D2>A2,D2<B2),"true","false"))

    Note the comma between A2 and D2.

  9. #9
    Forum Contributor
    Join Date
    06-13-2012
    Location
    ND
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: If statement to check if date falls between date range

    Perfect. Thanks

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

    Re: If statement to check if date falls between date range

    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)

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