简体   繁体   中英

Dynamic update based on today's date

I have the following table
在此处输入图像描述

Payments left is calculated by matching the first occurrence of value zero and returning the index of that row (I am subtracting 2 because first payment is on row 2).

This works now because first payment is on June 1, 2020 but If I open this spreadsheet 3 months from now it will still say payments left 15. That will not be correct anymore since at that time 3 payments are made so should say payment left 12.

Is there any way to dynamically know at what row should the calculation of "Payments left" start.

With other words if today is August 15 2020 (I can manually enter today's date if needed), then calculating Payments left should start from September 1, 2020 until the end.

DATEDIF() function returns the time period between 2 to dates in the units specified. You can keep today's day in one cell with the TODAY() function, and sum in your formula the index of the table plus the months elapsed since the last payment. Pesudocode example would be:

your formula + DATEDIF(LastpaymentCellAddress; TODAY()StoredCellAddress, "m")

The third argument "m" is to return the time elapsed in months.

https://support.office.com/en-us/article/calculate-the-difference-between-two-dates-8235e7c9-b430-44ca-9425-46100a162f38

Take into account that the dates in the arguments must follow an order fo the function to work, and the smaller date goes first. It is time from-to function.

Hope that helps

After playing a little bit around I was able to accomplish that with this formula: 在此处输入图像描述

where Last Payment Sent is: =DATE(YEAR(TODAY()),MONTH(TODAY()),1)

This should do the trick:

=COUNTIFS($A:$A,">"&TODAY())

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