Quick Basic Excel Question

Discussion in 'Archived Threads 2001-2004' started by Vince Maskeeper, Mar 20, 2003.

  1. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Trophy Points:
    0
    This is real basic, I'm sure, but I'm not a very active excel user:

    I have a date field (When a warranty expires), and then a field telling me how many days until that date.

    In some cases, the date is in the past- i.e. the Warranty is already expired. In which case, I get a #NUM! error- because I'm trying to subtract and getting negative days. I just want to add to my function a condition that will trap out the #NUM! error and display the text EXPIRED when it gets that error.

    I tried dabbling with tacking on an IF to my function, but it doesn't work. The formula to get the number of days is:

    =DATEDIF(NOW(),N2,"d")

    Wondered what I can tack on to make an IF("#NUM!","EXPIRED") type function work?

    -Vince
     
  2. Jeff R.

    Jeff R. Stunt Coordinator

    Joined:
    May 31, 1999
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    0
    Try:

    =IF(ISERROR(DATEDIF(NOW(),N2,"d")),0,DATEDIF(NOW(),N2,"d"))
     
  3. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Trophy Points:
    0
    Thanks Jeff, i just put in EXPIRED for 0, and it's rockin. Thanks a ton!
     
  4. Jeff R.

    Jeff R. Stunt Coordinator

    Joined:
    May 31, 1999
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    0
    correction: Replace 0 with "EXPIRED" to display the text you mentioned.
     
  5. Ted Lee

    Ted Lee Lead Actor

    Joined:
    May 8, 2001
    Messages:
    8,390
    Likes Received:
    0
    Trophy Points:
    0
    shoot vince...by reading your title, i thought you were going to ask how to sort a column or something. [​IMG]
     
  6. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Trophy Points:
    0
    Nope, not quite that simple.
     

Share This Page