+ Reply to Thread
Results 1 to 3 of 3

Formula doesnt work

  1. #1
    Kevin
    Guest

    Formula doesnt work

    I will be putting dates into cells in column A and B. I will use Row1 as
    the reference for my question.
    If I have dates in A1 and B1 I need to calculate the number of intervening
    months - I used =Datedif(a1,b1,"m"). If both cells are empty, I the number
    zero is returned. If one cell is empty, I get #Num. If both are populated,
    I get the correct answer.
    I want to supress both the 0 and the #num. I tried
    =if(iserror(and(isblank(a1),isblank(b1)),"",datedif((a1,b1,m)),"",if(and(isblank(a1),isblank(b1)),"",datedif((a1,b1,m)))

    It doesnt work, and I can not figure out what is wrong.

    Please help.

  2. #2
    Peo Sjoblom
    Guest

    Re: Formula doesnt work

    One way

    =IF(OR(A1="",B1=""),"",DATEDIF(A1,B1,"m"))

    --


    Regards,

    Peo Sjoblom


    "Kevin" <ksorei at yahoo.com> wrote in message
    news:[email protected]...
    >I will be putting dates into cells in column A and B. I will use Row1 as
    > the reference for my question.
    > If I have dates in A1 and B1 I need to calculate the number of intervening
    > months - I used =Datedif(a1,b1,"m"). If both cells are empty, I the
    > number
    > zero is returned. If one cell is empty, I get #Num. If both are
    > populated,
    > I get the correct answer.
    > I want to supress both the 0 and the #num. I tried
    > =if(iserror(and(isblank(a1),isblank(b1)),"",datedif((a1,b1,m)),"",if(and(isblank(a1),isblank(b1)),"",datedif((a1,b1,m)))
    >
    > It doesnt work, and I can not figure out what is wrong.
    >
    > Please help.




  3. #3
    Kevin
    Guest

    Re: Formula doesnt work

    it was indeed my logic. Switching from And to Or makes the world a
    wonderful place.
    Thank you

    "Peo Sjoblom" wrote:

    > One way
    >
    > =IF(OR(A1="",B1=""),"",DATEDIF(A1,B1,"m"))
    >
    > --
    >
    >
    > Regards,
    >
    > Peo Sjoblom
    >
    >
    > "Kevin" <ksorei at yahoo.com> wrote in message
    > news:[email protected]...
    > >I will be putting dates into cells in column A and B. I will use Row1 as
    > > the reference for my question.
    > > If I have dates in A1 and B1 I need to calculate the number of intervening
    > > months - I used =Datedif(a1,b1,"m"). If both cells are empty, I the
    > > number
    > > zero is returned. If one cell is empty, I get #Num. If both are
    > > populated,
    > > I get the correct answer.
    > > I want to supress both the 0 and the #num. I tried
    > > =if(iserror(and(isblank(a1),isblank(b1)),"",datedif((a1,b1,m)),"",if(and(isblank(a1),isblank(b1)),"",datedif((a1,b1,m)))
    > >
    > > It doesnt work, and I can not figure out what is wrong.
    > >
    > > Please help.

    >
    >
    >


+ 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