Compare Dates To Maximum Date

  • Hello,
    I have a problem of finding this formula,:confused:
    I eloborate my question to 3 parts:-


    1. I want to compare between Date1 and Date2 which one is the latest,
    2. Lets say Date2 is the latest,then i want to compare it with Date3 wether
    the length between Date2 & Date3 was 5 days.
    3. If the length less or equal to 5days, it will write '1' to colum A
    and if more than 5days ,it will write '1' to colum B


    example:
    --Date1---------Date2---------Date3--------------A-------B
    12/10/2006----11/10/2006---16/10/2006-----1-------
    17/10/2006----10/10/2006---22/10/2006----- -------1


    can anybody help me..please


    Regards;
    Hisham:)

  • Re: Comparing Length Of Dates & Put The Value To Other Colum


    hi sinac,


    welcome to Ozgrid.com


    place this in col A:
    =IF(($D4-MAX($B4:$C4))<=5,1,"")


    and this in col B:
    =IF(($D5-MAX($B5:$C5))>5,1,"")


    pls take note that the formulas doesn't take into account if date1 and/or date2 is bigger than date3

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!