B | C | D | E | F | G | |
5 | DEAL WITH DATES BEFORE 1900 | |||||
4 | START | END | START MODIFIED | END MODIFIED | DELTA DAYS | DELTA YEARS |
5 | 2/17/1850 | 5/15/1960 | 2/17/2850 | 5/15/2960 | 40264 | 110 |
6 | 1/5/1880 | 6/14/1900 | 1/5/2880 | 6/14/2900 | 7465 | 20 |
7 | 11/13/1600 | 11/13/1900 | 11/13/2600 | 11/13/2900 | 109573 | 300 |
8 | 8/8/1760 | 9/10/1880 | 8/8/2760 | 9/10/2880 | 43863 | 120 |
9 | 10/11/1660 | 12/9/1980 | 10/11/2660 | 12/9/2980 | 116937 | 320 |
10 | 3/6/1670 | 6/6/1940 | 3/6/2670 | 6/6/2940 | 98708 | 270 |
11 | 7/5/1889 | 10/11/1990 | 7/5/2889 | 10/11/2990 | 36987 | 101 |
12 | 12/22/1740 | 4/23/1900 | 12/22/2740 | 4/23/2900 | 58196 | 159 |
13 | 7/20/1650 | 5/29/1950 | 7/20/2650 | 5/29/2950 | 109521 | 299 |
14 | 12/12/1888 | 10/28/1970 | 12/12/2888 | 10/28/2970 | 29904 | 81 |
If the cell contains a real date,you want to add,1000 years.An easy way to do this is to use the EDATE function and add 12,000 months to the date. =EDATE(a5,12000) returns a date that is 1000 years after a valid date in a5. note that tis function requires the analysis toolpack in versions prior to excel 2007. if you can ensure the analysis tooolpack is installed ,you can use "=date(year(a5)+1000,month(a5),day(a5))" if the cell does not contain a real date,you need to break the date apart,add 1000 years, put the date back together,and convert it to a real date:
* To get the left portion of the date,use=left(a5,len(a5)-4) * To get the year portion of the date,use=right(a5,4) * To add 1000 years to the date,use=right(a5,4)+1000 * To put the month,day,year+1000 back together,use =left(a5,len(a5)-4)&right(a5,4)+1000 * To convert that rasult back to a true date use =datevalue(left(a4,len(a4)-4)&right(a4,4)+1000)
You now need to selectively use either the EDATE or the DATEVALUE portion of the formula, depending on whether excel sees the date in a5 as text.enter this if statement in cell c5: =if(istext(a5),datevalue(left(a5,len(a5)-4&right(a5,4)+1000),edate(a5,12000)) copy it to cell c5 in cell e5 calculates the number of elapsed days with=d5-c5, in cell f5 calculate the number of years with=dateif(c5,d5,"y") you can combine the formulas from c5,d5and e5 into a single mege formula: =if(istext(b5),datevalue(left(b5,len(b5)-4)&right(b5,4)+1000),edate(b5,12000))-if(istext(a5),datevalue(left(a5,len(a5)-4)&right(a5,4)+1000),edate(a5,12000))
No comments:
Post a Comment