简体   繁体   中英

Excel setting one cell value based on a a date range

I was wondering is somebody could help me with this problem, I have a spreadsheet like the one below.

I need a cell to equal the next payment number if the date is between to dates. So for example if today was the 20th January then the cell b2 would be 3 as the 1st Feb is the next payment number.

I was able to highlight a cell with conditional formatting for the next payment date, but this time I want cell b2 = the next payment number based on todays date.

Does anyone know the best way to achieve this 电子表格

Thanks in advance

David :)

如果您以日期格式获取C列中的日期,则可以使用以下公式:

=INDEX(B5:B11,MATCH(Today(),C4:C11,1))

If you are working with that list, a formula like this could be used:

=COUNTIF(C4:C11,"<"&TODAY())+1

if it is allways the same like in your example, you also could use this formula:

=MONTH(TODAY())*2+(DAY(TODAY())>15)

that code does not need any list ;)
still, you need to adjust the formulas by one day to in/exclude the actual day (so if it is the 16th Jan , is it still 2 or allready 3 ?)

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