+ Reply to Thread
Results 1 to 9 of 9

Insert a future date based on a number in another cell

  1. #1
    Registered User
    Join Date
    05-10-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    9

    Question Insert a future date based on a number in another cell

    Hi

    i'm trying to use an IF statement to insert a working day date later than today's date based on a number in another cell. For example if C2 has a number 5 in it then a date should automatically be entered, this being 5 working days from now.

    here is what i have at the moment

    =IF(C1:C5000="2",WORKDAY(TODAY(),2,""))*IF(C1:C5000="1",WORKDAY(TODAY(),1,""))*IF(C1:C5000="5",WORKDAY(TODAY(),,""))*IF(C1:C5000="3",WORKDAY(TODAY(),3,""))

    but is does not work as i get this 00/01/1900 in each cell.

    I'm new to this and i'm learning as i go along but this has me stumped!!
    Last edited by LongShanks; 05-10-2010 at 10:55 AM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Insert a future date based on a number in another cell

    Your formula probably doesn't work because you are using quotes around numbers like "3". That will only work if your column is text-formatted. If they are actual numbers you shouldn't use the quotes......however I'm not sure why you can't use this formula in row 1 copied down.

    =WORKDAY(TODAY(),C1)

    if you want to exclude cells which don't have numbers you could amend to

    =IF(ISNUMBER(C1),WORKDAY(TODAY(),C1),"")

    or for specific number only

    =IF(OR(C1={1,2,3,5}),WORKDAY(TODAY(),C1),"")
    Last edited by daddylonglegs; 05-10-2010 at 08:05 AM.

  3. #3
    Registered User
    Join Date
    05-10-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Insert a future date based on a number in another cell

    thanks daddylonglegs,

    =WORKDAY(TODAY(),C1) works fine but i have to change C1 to C2 and so on which is quite cumbersome as there are a few hundered entries, is there a way of using a range such as C1:C5000? I tried amending your code but it gave me an error.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Insert a future date based on a number in another cell

    If you use the formula

    =WORKDAY(TODAY(),C1)

    in D1 then you can "fill" that formula down the column and C1 will automatically change to C2, C3 etc. There are a number of ways to fill down:

    If you select cell D1 and then put the cursor on the bottom right corner of the cell you should see a black "+" - this is the "fill handle". If you now left-click the mouse and hold down you can just "drag" the formula down the column.

    If you have continuous data in column C you can just double click the fill-handle and it will automatically copy your formula as far down as you have data

  5. #5
    Registered User
    Join Date
    05-10-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Insert a future date based on a number in another cell

    thanks again daddylonglegs,

    this works great however, i want my spreadsheet to show blank cells until someone enters some data after which the information in column D will populate but not before. At the moment the cells in column D have (hash)VALUE! all the way down the column although this does change after a number is entered into column C.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Insert a future date based on a number in another cell

    Try using the second formula I suggested, i.e.

    =IF(ISNUMBER(C1),WORKDAY(TODAY(),C1),"")

    That checks whether C1 contains a number. If it does then the WORKDAY formula is activated, otherwise the cell remains blank

  7. #7
    Registered User
    Join Date
    05-10-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Insert a future date based on a number in another cell

    thanks,

    i've pasted in your formula but it does not appear to be working as all the cells are all blank, whether there is a number in column C or not

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Insert a future date based on a number in another cell

    That could happen if you have a number formatted as text. Try this version

    =IF(C1="","",IF(ISNUMBER(C1+0),WORKDAY(TODAY(),C1),""))

  9. #9
    Registered User
    Join Date
    05-10-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Insert a future date based on a number in another cell

    That's perfect!!

    I'm learning everyday, thank you very 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