+ Reply to Thread
Results 1 to 8 of 8

Number of Days between date but if cell has "na" go to next date

Hybrid View

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    81

    Number of Days between date but if cell has "na" go to next date

    My spread sheet consists of a column with a date and a column next to it with a formula that looks at that date and the date in front of it and returns the number of days between the two, this is repeated over 12 columns. Example Column A row 8 has a date, Column B row 8 has a date, column K has a formula =NETWORKDAYS(A8,B8) which works returning number of working days. My issue is I have 12 colums with dates in each and each one has a column with a formula next to it. Each column with a formula looks at the two dates in front of it to return a number of days, but some times the spread sheet will have 6 of the columns with "na" in the cell instead of a date. The first 5 columns always have a date and sometime the next six columns have "na" and the last column always has a date. If the last column can't return a number of days because the date in front of it is "na" I want it to first look at the next 5 or 6 columns that could have a date and if "na" keep looking until it finds a date to calculate number of days from last entered date. Did I make this very confusing.


    can anyone help?

  2. #2
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Number of Days between date but if cell has "na" go to next date

    how about nested ifs?

    ie
    Formula: copy to clipboard
    =NETWORKDAYS(A8,IF(B8<>"na",B8,IF(D8<>"na",D8,if(...,"na"))))

    ?

  3. #3
    Registered User
    Join Date
    11-27-2012
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: Number of Days between date but if cell has "na" go to next date

    Master PCN Data.xlsmSimarui,

    I tried it but no luck, I'm sure it is me!
    I attached the file for you to look at if that is ok.
    The cell in RED looks at the first two cells in Yellow in front of it (EW12 & EJ12) the way I have it setup currently is if their is a date in EJ12 its happy and gives me a number of days between dates, if no date is in cell EJ12 or "na" is their I want it to look at DW12 the next one back and keep going until it finds a date (in this case Orange cell BJ12) and puts a number of Networkdays in the Red cell FI12. So it is looking at the date in cell EW12 and BJ12 and giving a number of days.

    Hope this makes sense.
    Jim

  4. #4
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Number of Days between date but if cell has "na" go to next date

    Try this:

    =NETWORKDAYS(LOOKUP(2,1/(ISNUMBER(J12:EJ12)*(J$6:EJ$12<>"")),J12:EJ12),EW12)

  5. #5
    Registered User
    Join Date
    11-27-2012
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: Number of Days between date but if cell has "na" go to next date

    Did not work! Part of your formula has me confused =NETWORKDAYS(LOOKUP(2,1/(ISNUMBER(J12:EJ12)*(J$6:EJ$12<>"")),J12:EJ12),EW12) should the J$6:EJ$12 be J$12:EJ$12? I tried changing the 6 to a 12 but still did not work.

  6. #6
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Number of Days between date but if cell has "na" go to next date

    Quote Originally Posted by Bikeman View Post
    Did not work! Part of your formula has me confused =NETWORKDAYS(LOOKUP(2,1/(ISNUMBER(J12:EJ12)*(J$6:EJ$12<>"")),J12:EJ12),EW12) should the J$6:EJ$12 be J$12:EJ$12? I tried changing the 6 to a 12 but still did not work.
    It should be (J$6:EJ$6<>"")instead of (J$6:EJ$12<>"")

+ 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