+ Reply to Thread
Results 1 to 21 of 21

365 day countdown between two dates

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

    365 day countdown between two dates

    Hi ppl,

    I am in great need of some help! I am trying to achieve the following:

    I have been asked by work to create a document which effectively counts down the number of days since a pre defined day, for example:

    If

    Start date = 22/11/1980
    Todays date = 27/10/10

    I need a way which it can count down the day from today's date till 21/11/10. However I cant change the start date year to make the sum easier

    so for example, the answer would be -26, as todays date increased the number of days increases, until there is 0 days left. Then its resets itself and starts counting down from -365 days

    I have tried many formula's such as "=SUM(E15-B15)-(365* no of years)" however this forumla doesnt seem to work.

    Can anyone help me?

    Many thanks!

    Tom
    Last edited by tom_k88; 10-27-2010 at 07:44 AM.

  2. #2
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: Are you an excel expert?

    hey Tom - i would quickly check the forum rules and re-post with a more accurate thread tittle before you are red carded.....
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,625

    Re: Are you an excel expert?

    Would that be the 21st day of the 14th month of the year, or the 14th day of the 21st month? :-)

    Try formatting the cell as general AFTER you have entered the formula

    Regards


    @Darren: good call
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Are you an excel expert?

    Quote Originally Posted by TMShucks View Post
    Would that be the 21st day of the 14th month of the year, or the 14th day of the 21st month? :-)

    Try formatting the cell as general AFTER you have entered the formula

    Regards


    @Darren: good call
    haha! My bad! thanks for pointing that out! And thanks for the heads up about the title!

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

    Re: Are you an excel expert?

    Quote Originally Posted by TMShucks View Post
    Would that be the 21st day of the 14th month of the year, or the 14th day of the 21st month? :-)

    Try formatting the cell as general AFTER you have entered the formula

    Regards


    @Darren: good call
    I have tried all sorts of different formating, not of which seems to work. I am not sure whether leap years are messing the dates up or something.....

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,625

    Re: 365 day countdown between two dates

    With:

    Please Login or Register  to view this content.

    Or, you can miss out the intermediate step (F16):

    Please Login or Register  to view this content.

    The output cell, F20, can be any cell you choose.

    If you can get the basic calculation and display to work, you can substitute alternative values.

    You might need to add a fudge factor if you're looking to "adjust" the result (for whatever reason)

    Regards

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

    Re: 365 day countdown between two dates

    thankyou TMShucks, thankyou TMShucks, however that only works for dates approaching the E15 date. If you change the B15 value to 28/10/09 the output is -1 however I would like it to say -364 if you understand me?

    Many thanks,

    Tom

    Tom
    Last edited by tom_k88; 10-27-2010 at 09:18 AM.

  8. #8
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: 365 day countdown between two dates

    Not sure why your last example should be -364

    =ROUND(MOD(B9-B8,365.2425),0)-365

    as far as I can see your logic is

    how long is it to the next occourence of DD/MM

    Since this should always be in the future the range should be 0-365(366) negated if you wish to have a negative figure.
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


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

    Re: 365 day countdown between two dates

    Thanks for the reply!

    My logic is this........my collegue need a system which will notify him that a year has past from a certain date, as after a year he needs to call the client. So I wanted to develop a system where it would count down from -365 until 0, when it reached 0 I was going to have some conditional formating to highlight the cell, meaning that he needed to call that client. However after 0, it needs to reset to -365 and start counting down again.

    B9-B8, what are those figures?

    Many thanks,

    Tom

  10. #10
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: 365 day countdown between two dates

    B8 is the start date
    B9 is the days until

    this might help :-
    =DATE(YEAR(D9)+(DATE(YEAR(D9),MONTH(D8),DAY(D8))<D9),MONTH(D8),DAY(D8))

    Will calculate the next aniversary

    =DATE(YEAR(D9)+(DATE(YEAR(D9),MONTH(D8),DAY(D8))<D9),MONTH(D8),DAY(D8))-D9

    Will calculate how many days until this date

  11. #11
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: 365 day countdown between two dates

    Quote Originally Posted by squiggler47 View Post
    B8 is the start date
    B9 is the days until

    this might help :-
    =DATE(YEAR(D9)+(DATE(YEAR(D9),MONTH(D8),DAY(D8))<D9),MONTH(D8),DAY(D8))

    Will calculate the next aniversary

    =DATE(YEAR(D9)+(DATE(YEAR(D9),MONTH(D8),DAY(D8))<D9),MONTH(D8),DAY(D8))-D9

    Will calculate how many days until this date
    Thankyou, thats perfect!

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

    Re: 365 day countdown between two dates

    Quick question:

    I am trying to create an IF formula with multiple conditions. Its probably easier to explain what I want first...........basically I want a cell on my excel sheet that looks at two dates and if they are the same highlights the "status" cell with a colour.

    At I have the fomula:

    =IF(F12=D12, "Ring Client","Pending")

    F12 = Todays Date

    D12 = Anniversary date

    G12 = Week before anniversary date

    However I would like another condition that says highlight the "status" cell with orange a week before the anniversary date.

    I presume I need some sort of IF statement?

    If anyone can help me it would be greatly appreciated!

    Tom

  13. #13
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: 365 day countdown between two dates

    select the cell you want yo highlight, use conditional formatting from the format menu

    in the first box, change the dropdown to formula

    then simply type =$f$12=$g$12, select the formatting style you require, and you should highlight a week before!

  14. #14
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: 365 day countdown between two dates

    squiggler47, I cant thank you enough!

    If you would be co helpful, I have a few other questions to ask:

    1.) I thought I had made a formula to work out the week before the anniversary but when I tested it, it didnt work correctly. What formula do I require?

    2.) You very kindly gave me this formula "=DATE(YEAR(F12)+(DATE(YEAR(F12),MONTH(C12),DAY(C12))<F12),MONTH(C12),DAY(C12))" Which sorta works but for some reason it has some anomolies

    27/10/09 27/10/2011 2 days, 0 months, 1 years 29.10.10

    it thinks that a year from the SD of 27/10/09 is 27/10/11?

    I have used this formula

    "=DATE(YEAR(C12)+1,MONTH(C12),DAY(C12))" which seems to work, however I now have another issue..... I need to sort the date by the closest date to todays date being at the top of the table. If I could have a formula to do such a thing I was then going to create a macro that sorted the table automatically

    Thanks you so much, you have been great!

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

    Re: 365 day countdown between two dates

    Quote Originally Posted by tom_k88 View Post
    I need to sort the date by the closest date to todays date being at the top of the table.
    Hello Tom,

    What do you mean by closest, do you mean the one that's nearest to an anniversary as related to your original question?

    For your original question, assuming you have a date in A1 then this formula will give you a countdown to the next anniversary as you requested

    =B$1-EDATE(A1,DATEDIF(A1,B$1-1,"y")*12+12)

    where B1 = TODAY()

    That uses EDATE which requires Analysis ToolPak to be enabled (or you can use a longer version without EDATE).

    You could use that formula against each date and then sort by that column
    Audere est facere

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

    Re: 365 day countdown between two dates

    Quote Originally Posted by tom_k88 View Post
    1.) I thought I had made a formula to work out the week before the anniversary but when I tested it, it didnt work correctly. What formula do I require?
    If the date in A1 is 22/11/1980 then I assume that right now you want that to show 15/11/2010......but when does that change to 15/11/2011, on 15/11, after 15/11....or on or after 22/11?

    You can adjust my previous suggestion to do any of those, e.g.

    =EDATE(A1,DATEDIF(A1,B$1+6,"y")*12+12)-7

    that will display 15/11/2010 until 15/11/2010...then after that it will display 15/11/2011

  17. #17
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: 365 day countdown between two dates

    thanks for your reply daddylonglegs!

    It prob alot easier if I upload where I have got too....

    What would like to achieve is the following.

    I have a list of start dates and todays dates. I would like this excel sheet to work out when the anniversary of the start date is. Then using this date I would like to create a system (Status column) that will display an orange box when the start date is a week away, and a red box when the start date = todays. I also need to have some sort of ranking system that sorts the date so that the most recent date to todays date is at the top of the cololum. This is so that I dont have to trial through potentially hundreds of clients to find out which ones are closest to todays date.

    If you could help me that would be great!

    I cant thank you enough for your help! I thought I was good at excel but in fact I am s**t lol!
    Attached Files Attached Files

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

    Re: 365 day countdown between two dates

    I put today's date in A7 so you only have to reference a single cell

    In D12 copied down I used this formula for the next anniversary date

    =EDATE(C12,DATEDIF(C12,A$7-1,"y")*12+12)

    and then in C12 copied down I used

    =IF(D12=A$7, "Ring Client",IF(D12-A$7<=7,"Within 7 days","Pending"))

    That will change the text accordingly - I changed conditional formatting so the "Within 7 days" rows are orange.

    For today's date nothing was formatted so I changed A7 to = TODAY()+19 - that's just for testing you should change it back to just = TODAY()

    You can sort by the Anniversary date or the "days to Anniv" column. Either way you need to do that as the date changes. Does that work for you?

    If EDATE formula doesn't work try enabling Analysis ToolPak

    Tools > add-ins > tick "Analysis ToolPak"

    see attached
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: 365 day countdown between two dates

    thankyou daddylonglegs, I cant thank you enough! Just a small issue, there seems to be some issues with Anniversary collumn. Some of the dates are not just a year in advance for example, row 26, the start date is 12/02/08 and the anniversary is 12/02/11?

    When I next paid, I will donate something towards the site, your help has been greatly appreciated!



    Many thanks,

    Tom
    Last edited by tom_k88; 10-29-2010 at 10:37 AM.

  20. #20
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: 365 day countdown between two dates

    Any chance of one last bit of help daddylonglegs?

  21. #21
    Registered User
    Join Date
    10-27-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: 365 day countdown between two dates

    ignore my last post....i was being stupid and you were right! 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