+ Reply to Thread
Results 1 to 5 of 5

Dates in IF formula

Hybrid View

  1. #1
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267

    Dates in IF formula

    Here is the formula we are using:

    =IF(1/1/2004<='Info Sheet'!$D$46<3/1/2004,'Info Sheet'!$F$46,0)
    What it is supposed to do is to check to see if the date in InfoSheet!D46 is between 1/1/2004 and 3/1/2004. Even though this should have been true, it was returning the 0 from the IF statement. We also tried setting up dummy cells with dates in them and changing our 2004 dates to cell references, but that didn't do it either. DOes anyone have any ideas on how to make this work? Thanks, much appreciated.

    Will

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719
    Try

    =IF(AND("1/1/2004"+0<='Info Sheet'!$D$46,'Info Sheet'!$D$46<"3/1/2004"+0),'Info Sheet'!$F$46,0)

  3. #3
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    That worked, thanks a lot. What does the AND do?

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,719
    Excel has no "between" function and you can't use a construction like

    4<=A1<6

    so you need to check both conditions. AND function is only true when all clauses are true so you'd use

    =IF(AND(4<=A1,A1<6),......

    or you can use * like

    =IF((4<=A1)*(A1<6),......

  5. #5
    Forum Contributor wmorrison49's Avatar
    Join Date
    09-25-2007
    Posts
    267
    Gotcha, I didn't know that. Thank you so much!

+ 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