简体   繁体   中英

Trying to calculate a renewal date in excel

Have a few different items with different rental periods ( 1,3,6 months to 1,3,5 years). As it stands I have a column with the last renewal date and a column indicating what is the renewal period. I wanted excel to calculate what the Renewal date would be based on the selected type of renewal. My first attempt was to convert the renewal types to some kinda of similar denomination but i got stuck trying to figure out what value/format to use.

Last renewal date   Renewal Type    Renewal Date    
11/11/2013           1 Year 
2/14/2014            2 Years    
8/28/2011            5 Years    
11/27/2013           3 Months   

[Excel stores dates as floating point numbers. They advance by 1 each day and the fractional part holds the day fraction, eg 0.5 is midday. The exact value is user-configurable between 1900 and 1904 origins which can complicate things. Note that in the 1900 origin, date 60 (corresponding to the non-existent date 29-Feb-1900) is defined. Leap seconds are not implemented.]

If you can tolerate the second column being integral months, then use the EDATE function.

For example, if your table is orientated on cell A1 , use

=EDATE(A2, B2) in cell C2 and copy downwards.

I would use a Vlookup in the third column which should point to a table which has conversion of 1 year/6mos into days. (365,180, ect). Then just add that vlookup to the original date.

So

   `TblDate
 Lookup Days
 1mo    30
 ..     ..`

=VLOOKUP(B1,TblDate,2,FALSE)+A1

也许尝试:

=IF(ISERROR(FIND("year",B2)),DATE(YEAR(A2),MONTH(A2)+LEFT(B2,1),DAY(A2)),DATE(YEAR(A2)+LEFT(B2,1),MONTH(A2),DAY(A2)))

There is a way to convert your second column into pure month format, using Excel:

=IF(COUNTIF(B2,"*Year*"),(TRIM(LEFT(B2,2)))*12,IF(COUNTIF(B2,"*Month*"),TRIM(LEFT(B2,2)),NA()))

This can then be used with EDATE() . For example, lets say that the above code is in cell C2, it would produce 12 . Then, you could in cell D2, you could put

EDATE(A2,C2)

in there. The code works for anything between 1 month and 99 years and doesn't care whether the first number is one or two digits and whether the word is month, months, year or years - it will work with all of it, as TRIM() removes whitespace (thus allowing for one character and a space or two characters) and * is a wildcard (hence allowing x years or xz year ).

For EDATE to work you need to make sure the number format is set to date type.

Note: an extra cell for the months will be needed - so it might require a little rearranging, but using CTRL + C or copy cells tool in the bottom right of a selected cell will easily copy it, and for each one it will automatically convert it.

In D2 enter:

=--MID(B2,1,FIND(" ",B2))

and copy down

In E2 enter:

=MID(B2,FIND(" ",B2)+1,1)

and copy down

Finally in C2 enter:

=IF(E2="Y",DATE(YEAR(A2)+D2,MONTH(A2),DAY(A2)),DATE(YEAR(A2),MONTH(A2)+D2,DAY(A2)))

Format C2 as Date and copy down. For example:

.

.

演示

create a new column and type in the formaula box

 =B2+1095 

to get your renewal date

1 year is 365 2 years is 730 3 years is 1095 and so on and so forth.

this was the most simple way and worked for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM