MS Office Forum / Excel / New Users / March 2008
Venturing into date formulas...
|
|
Thread rating:  |
TechnoGram - 07 Mar 2008 22:35 GMT Do not know if this is possible, but believe all is possible given the right guidance... Have a worksheet and shall we say in column C there is a date Jan 1, 2008 Now in column E I would like it to take the date from column C and show the number of days left in a 2 year period from the original input date of 1/1/08 So basically when you input 1/1/08 it would show say 730 in E and if you change the date in C to February 1, 2008 it would show 699. Is this possible?????
PCLIVE - 07 Mar 2008 22:45 GMT What defines the two year period? Is it two years from the year of the date in C?
Maybe this is one way:
=(C1+730)-C1
HTH, Paul
> Do not know if this is possible, but believe all is possible given the > right guidance... [quoted text clipped - 6 lines] > you change the date in C to February 1, 2008 it would show 699. > Is this possible????? PCLIVE - 07 Mar 2008 22:53 GMT Ok.. that was completely wrong. Try this:
=DATE(YEAR(C1)+1,12,31)-C1
> What defines the two year period? Is it two years from the year of the > date in C? [quoted text clipped - 16 lines] >> you change the date in C to February 1, 2008 it would show 699. >> Is this possible????? Tyro - 07 Mar 2008 23:03 GMT Dates are numbers to Excel. Jan 1, 1900 is day 1. Jan 1, 1950 is day 18264. July 25, 1980 is day 29427. March 7, 2008 is day 39514. When you format these numbers as dates you see something humans understand as a date. To Excel, the dates are simply numbers. And you can treat them as numbers. For example to add 37 days to a date, simply =DateCell + 37 and format the answer as a date.
Tyro
> Do not know if this is possible, but believe all is possible given the > right guidance... [quoted text clipped - 6 lines] > you change the date in C to February 1, 2008 it would show 699. > Is this possible????? TechnoGram - 08 Mar 2008 17:37 GMT > Dates are numbers to Excel. Jan 1, 1900 is day 1. Jan 1, 1950 is day 18264. > July 25, 1980 is day 29427. March 7, 2008 is day 39514. [quoted text clipped - 17 lines] > > - Show quoted text - Thank you for the info on dates and how Excel views them. There must be a very simple way to format a cell to tell what the number of the current day is and does it take into account leap years. What if you were wanting to count dates from pre 1900?
As to the formula given by Sandy and Ken I have tested it out and it does seem to do the job. I willl put it before the person requesting the information and see if it works for him. The purpose of why things are being used is always helpful and I should maybe have been more helpful in that regard. What we are doing is tracking time when tools have to be calibrated and when parts have to be replaced in an aviation setting. As it sometimes takes 3 to 6 months to order a part I want a count down and then can conditionally format it to turn color on reorder date.
Now the only hiccup is these issues sometimes get done ahead of time which then would start the cycle again before the prior cycle was complete... example part calibrated Jan 1, 2008 does not need to be recalibrated for 2 years. August 2008 the part is replaced and the 2 year cycle entered on Jan 1 is replaced by a new 2 year cycle starting in Aug 2008....
My test shows that if you simply put in Aug date the result still tells you the countdown from Jan. Not that this information is not needed but if you need to restart the cycle what would you have to do??
Tyro - 08 Mar 2008 18:33 GMT If you have a date in A1 cell you can view the number with =N(A1). Also you can see the number by simply pressing Ctrl+Accent grave(`), the key above the tab key. This will also show you all the formulas on your worksheet. Just press Ctrl+Accent grave (`) again to return to normal view. As for dates prior to January 1, 1900 go to John Walkenbach's web site http://j-walk.com/ss. He has an add-in for Excel called Power Utility Pack. Part of that add-in can handle dates going back to the year 100. The utilities cost $40. But if you buy his books, Excel 2007 Bible, Excel 2003 Bible for example, $40, the books have a coupon that gets you the utilities for $10 and the VBA source code for an additional $20. You should be aware that Excel has a bug in its dates. Excel will tell you that there was a February 29, 1900. There was not. End-of-century years such as 1700, 1800, 1900, 2000 etc. although evenly divisible by 4 are not leap years unless they are evenly divisible by 400 - so 1700, 1800, 1900 are not leap years but 2000 is. Centuries actually begin with the year 1, such as 2001 the first year of the 21st century. 2000 was the last year of the 20th century. But this somehow got lost in the shuffle. The bug of February 29, 1900 started in Lotus 123 and Microsoft decided to retain the bug so that people could convert their Lotus spreadsheets to Excel. As for date computations, Excel has a few functions such as DATE, DATEVALUE, DAY, DAYS360, EDATE*, EOMONTH*, MONTH, NETWORKDAYS*, NOW, TODAY, WEEKDAY, WEEKNUM*, WORKDAY*, YEAR and YEARFRAC*. The * means that in versions of Excel prior to Excel 2007, the Analysis Toolpak must be installed. Excel 2007 has all of the functions. You might also note that time is stored as a fraction of 24 hours along with the date. 1 second is 1/(24*60*60), 1 minute is 1/(24*60), one hour is 1/24. Thus 12 AM is 0/24 = 0.0, 3 AM is 3/24 = 0.125, 12 PM is 12/24 = 0.5. March 8, 2008 is day 39515 and March 8, 2008 12 PM is 39515.5. Just as an aside, when Pope Gregory developed the Gregorian calendar, he dropped 11 days from the Julian calendar in the 1500's. This change took effect in England and the U.S. in 1752. Feb 11, 1752 was followed by Feb 22. There will be an additional day dropped from the calendar in the 3400's. Excel will almost certainly not take this into account. So much for having dates expressed as numbers. Excel's date range is Jan 1, 1900 - day 1 through Dec 31, 9999 - day 2,958,465.
Tyro
On Mar 7, 3:03 pm, "Tyro" <T...@hotmail.com> wrote:
> Dates are numbers to Excel. Jan 1, 1900 is day 1. Jan 1, 1950 is day > 18264. [quoted text clipped - 22 lines] > > - Show quoted text - Thank you for the info on dates and how Excel views them. There must be a very simple way to format a cell to tell what the number of the current day is and does it take into account leap years. What if you were wanting to count dates from pre 1900?
As to the formula given by Sandy and Ken I have tested it out and it does seem to do the job. I willl put it before the person requesting the information and see if it works for him. The purpose of why things are being used is always helpful and I should maybe have been more helpful in that regard. What we are doing is tracking time when tools have to be calibrated and when parts have to be replaced in an aviation setting. As it sometimes takes 3 to 6 months to order a part I want a count down and then can conditionally format it to turn color on reorder date.
Now the only hiccup is these issues sometimes get done ahead of time which then would start the cycle again before the prior cycle was complete... example part calibrated Jan 1, 2008 does not need to be recalibrated for 2 years. August 2008 the part is replaced and the 2 year cycle entered on Jan 1 is replaced by a new 2 year cycle starting in Aug 2008....
My test shows that if you simply put in Aug date the result still tells you the countdown from Jan. Not that this information is not needed but if you need to restart the cycle what would you have to do??
Sandy Mann - 08 Mar 2008 19:39 GMT .>My test shows that if you simply put in Aug date the result still
>tells you the countdown from Jan. Put the date in where? C1? A new date in C1 will give a new calculation. If you don't want to retain the old count down, (it will become negative after the due date), then try:
=IF(C1="","",IF(AND(E2="",DATE(YEAR(C1)+2,MONTH(C1),DAY(C1))-TODAY()<0),"Calibration Overdue!",IF(E2<>"","Part Replaced/Recolibrated",DATE(YEAR(C1)+2,MONTH(C1),DAY(C1))-TODAY())))
In E1 and copy down as far as required.
If there is no date in Column B in the Row below then the cell in Column E will apprear blank.
If the Calibration period has expired and no Recalibration/Replacement has been carried out then it will say "Calibration Overdue!"
If the part has been Recalibrated or Replaced and a new date inserted in Column B of the Row below then it will say "Part Replaced/Recalibrated"
All the rest of the time it will tell you how many days there are left until the next due date.
 Signature HTH
Sandy In Perth, the ancient capital of Scotland and the crowning place of kings
sandymann2@mailinator.com Replace @mailinator.com with @tiscali.co.uk
On Mar 7, 3:03 pm, "Tyro" <T...@hotmail.com> wrote:
> Dates are numbers to Excel. Jan 1, 1900 is day 1. Jan 1, 1950 is day > 18264. [quoted text clipped - 22 lines] > > - Show quoted text - Thank you for the info on dates and how Excel views them. There must be a very simple way to format a cell to tell what the number of the current day is and does it take into account leap years. What if you were wanting to count dates from pre 1900?
As to the formula given by Sandy and Ken I have tested it out and it does seem to do the job. I willl put it before the person requesting the information and see if it works for him. The purpose of why things are being used is always helpful and I should maybe have been more helpful in that regard. What we are doing is tracking time when tools have to be calibrated and when parts have to be replaced in an aviation setting. As it sometimes takes 3 to 6 months to order a part I want a count down and then can conditionally format it to turn color on reorder date.
Now the only hiccup is these issues sometimes get done ahead of time which then would start the cycle again before the prior cycle was complete... example part calibrated Jan 1, 2008 does not need to be recalibrated for 2 years. August 2008 the part is replaced and the 2 year cycle entered on Jan 1 is replaced by a new 2 year cycle starting in Aug 2008....
My test shows that if you simply put in Aug date the result still tells you the countdown from Jan. Not that this information is not needed but if you need to restart the cycle what would you have to do??
Sandy Mann - 07 Mar 2008 23:12 GMT I don't follow what you are saying:
> So basically when you input 1/1/08 it would show say 730 in E and if > you change the date in C to February 1, 2008 it would show 699. That would only be 730 on 1/1/08 and February 1, 2008 would again be 730, (ie two years for the date in Column C), not 669 unless you are getting the end date form somewhere else.
Do you mean:
=DATE(YEAR(C1)+2,MONTH(C1),DAY(C1))-TODAY()
 Signature HTH
Sandy In Perth, the ancient capital of Scotland and the crowning place of kings
sandymann2@mailinator.com Replace @mailinator.com with @tiscali.co.uk
> Do not know if this is possible, but believe all is possible given the > right guidance... [quoted text clipped - 6 lines] > you change the date in C to February 1, 2008 it would show 699. > Is this possible????? Ken Johnson - 07 Mar 2008 23:17 GMT > Do not know if this is possible, but believe all is possible given the > right guidance... [quoted text clipped - 6 lines] > you change the date in C to February 1, 2008 it would show 699. > Is this possible????? Maybe...
=VALUE(DATE(YEAR(C1)+2,MONTH(C1),DAY(C1))-INT(NOW()))
Format E1 General
Ken Johnson
Sandy Mann - 07 Mar 2008 23:27 GMT Ken,
If you are going toformat the cell as General why use VALUE()?
 Signature HTH
Sandy In Perth, the ancient capital of Scotland and the crowning place of kings
sandymann2@mailinator.com Replace @mailinator.com with @tiscali.co.uk
>> Do not know if this is possible, but believe all is possible given the >> right guidance... [quoted text clipped - 14 lines] > > Ken Johnson Ken Johnson - 08 Mar 2008 01:16 GMT > Ken, > [quoted text clipped - 28 lines] > > > Ken Johnson Hi Sandy,
I noticed that without VALUE, if I double click that cell then click elsewhere the formatting automatically reverted to date. With VALUE, after reformatting back to General it stayed that way after double clicking in then clicking out.
BTW, my only reason for not using TODAY was that I didn't think of it, I don't work with dates all that often.
Ken Johnson
|
|
|