+ Reply to Thread
Results 1 to 13 of 13

Calculate dates based on values entered or based on today’s date

  1. #1
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Calculate dates based on values entered or based on today’s date

    I hope I don’t confuse anyone. I need to calculate dates based on values entered or based on today’s date. Column “B” will always have a date. Colum “M” will only have a date when it was corrected. In column “A” I have a formula that reads “=IF(M2<B2,””,M2-B2)” it will return the difference in days. I also have it set to conditional format and turn read if greater than 2 days. Now there will be times when a date hasn’t been entered in column M because it hasn’t been resolved. So in this case I need it to look at the date in Column “B” and look at today’s date and return that difference.

    1. Column A is the formula calculates dates
    2. Column B is a date
    3. Column M, date when is corrected or need difference between column B date and todays date.

    The formula needs to exclude weekends

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Calculate dates based on values entered or based on today’s date

    Please Login or Register  to view this content.
    I believe that should give you what you want.
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Calculate dates based on values entered or based on today’s date

    Will it exclude weekends? In other words it only looks at a 5 day work week. Also how do I remove if I receive a #VALUE!. Part if the formula is working if I have a date in B and M but if "M" is blank I getting an #VALUE! error

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Calculate dates based on values entered or based on today’s date

    Yes NETWORKDAYS ignores weekends.

    I dont get the problem with the blank M's but Excel is very iffy around what is BLANK or not ie if you have a space in there, then its not blank.

    try

    Please Login or Register  to view this content.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Calculate dates based on values entered or based on today’s date

    This appears to work with various combinations of dates in column B and M:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    NETWORKDAYS doesn't count weekends but you can't define what a weekend is. It does however recognize holidays and I used the range $V$1:$V$10 for holidays.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Calculate dates based on values entered or based on today’s date

    pjwhitfield - I keep getting the #Value! on some cells. I went back and check and it turns out that some have N/A in the "M" column date. Is their away around this where it will ignore that?

    newdoverman - your formula worked but it continues to calculate todays date vs what in column "B". In other word if the date in column B was 3/2/2015 and the date in column M was 3/3/2015 the results is 111 days. It should read 1 day. the only time it should read 111 if M was blank.

    I appreciate the help each of you are providing.

  7. #7
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Calculate dates based on values entered or based on today’s date

    Ok I got this to work I just need to figure out the removal of #VALUE!. The formula I use is =IF(M2="",NETWORKDAYS(B2,IF(LEN(M2)<3,TODAY(),M2)),M2-B2)

  8. #8
    Valued Forum Contributor
    Join Date
    02-07-2013
    Location
    Philippines
    MS-Off Ver
    Excel Online; 365
    Posts
    610

    Re: Calculate dates based on values entered or based on today’s date

    try this:

    =IFERROR(IF(M2="",NETWORKDAYS(B2,IF(LEN(M2)<3,TODAY(),M2)),M2-B2),"")
    If I've helped U pls click on d *Add Reputation

  9. #9
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Calculate dates based on values entered or based on today’s date

    Awesome, that seems to have done the trick. Thank you for your assistance.

  10. #10
    Valued Forum Contributor
    Join Date
    02-07-2013
    Location
    Philippines
    MS-Off Ver
    Excel Online; 365
    Posts
    610

    Re: Calculate dates based on values entered or based on today’s date

    glad you were able to make it work.

    If you're satisfied with the solution provided please mark this thread as solved and consider adding a rep to those who have helped you.

  11. #11
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Calculate dates based on values entered or based on today’s date

    Quote Originally Posted by L40 View Post
    Ok I got this to work I just need to figure out the removal of #VALUE!. The formula I use is =IF(M2="",NETWORKDAYS(B2,IF(LEN(M2)<3,TODAY(),M2)),M2-B2)
    That solution doesnt check if M2 < B2 which your original request needed.

    Also however your formula doesnt do what you were after.

    You're only ignoring Weekends if M2 is blank, if it isnt then your just taking B2 away from M2?

    wrap my original solution in an IFERROR

    ie
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Calculate dates based on values entered or based on today’s date

    You are correct, I ended up using this formula =IFERROR(IF(M2="",NETWORKDAYS(B2,IF(LEN(M2)<3,TODAY(),M2)),M2-B2),""). It seems yours does the same and is cleaner so I will take that route. Here is my issue now. If B2 has no date the cell with the formula is returning a number of 30,158. I need this to remain blank until a date is entered in B2. How can I correct this?

  13. #13
    Registered User
    Join Date
    02-05-2013
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Calculate dates based on values entered or based on today’s date

    Ok I got it to do what I wanted with my old formula by adding an if statement at the beginning =IF(B2>0,IFERROR(IF(AND(M2="",B2<>""),NETWORKDAYS(B2,IF(LEN(M2)<3,TODAY(),M2)),M2-B2),"0"),"")

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. calculate data in cells based on today's date
    By stewdizzle in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-02-2015, 03:50 PM
  2. Calculate Reporting Period based on Today's Date
    By jeversf in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-22-2013, 08:03 PM
  3. [SOLVED] Calculating a week of dates/days based on the beginning date entered...
    By tiffany04530 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 11-27-2012, 09:55 AM
  4. [SOLVED] Calculate entries based on Date entered
    By vew32 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-23-2012, 07:04 AM
  5. Replies: 6
    Last Post: 03-04-2010, 03:04 PM
  6. Create a Pie Chart based on Date values entered.
    By avidcat in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 12-11-2009, 07:24 AM
  7. Replies: 2
    Last Post: 04-14-2005, 12:06 AM

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