Add 1 month to date for each cell that equals n

时间:2015-07-31 20:19:02

标签: excel date time

I am trying to make a payment sheet, where if cell D2 equals 3000 it adds one month to a date in cell F4. But if cell D4 also equals 3000 it adds another month to the date in cell F4.

So that everytime I enter 3000 into D2, D4, D6 or D8 and so on, it adds one month to the date in cell F4. Get what I'm saying?

So example. D2 has a log that the 3000 was payed. This will add one month to the date 08-20-2015 to make it 09-20-2015. 09-20-2015 swings around and I add 3000 into D4. This will now add 1 month to the previous date of 09-20-2015 to make it 10-20-2015.

Thanks for any help!

1 个答案:

答案 0 :(得分:0)

Here's a formula that should do the trick:

=EDATE(F4,(SUM(IF(MOD(COLUMN(3:3),2)=0,3:3,0))/3000))

Instead of pressing enter to confirm the formula, use CTRL + ALT + ENTER as it is an array formula.

This sums every other cell in row D, then divides by 3000 and adds that number of months to your date.