Performing EDATE on a Range of Dates, Then Checking if any of the generated dates Fall Between Two Dates

ejw412

New Member
Joined
May 19, 2020
Messages
10
Office Version
  1. 365
Platform
  1. MacOS
Hello all -

The title to my post kind of says what I'm trying to do. I have a column of dates that are the first dates for the year that recurring bills will come due. The comparison that I'm trying to do is to look at that entire column, figure out the same day for each subsequent month for each date, then determine if any of those dates fall between two comparison dates. Here's what this would look like, because it's probably easier to visualize:
First Invoice Due DateCompare Start DateCompare End DateSubsequent Invoice Due?
1/10/20203/12/20203/15/2020True
1/15/20203/5/20203/7/2020False
1/20/20203/17/20203/19/2020False
1/30/20204/11/20204/16/2020True

So 3/12/2020|3/15/2020 would match 1/15/2020, and 4/11/2020|4/16/2020 would also match 1/15/2020

Here's the catch - i need to do this all at once, to see if ANY of the First Invoice Due Dates fall within ANY of the Compare (subsequent) ranges, when adjusted with a function like EDATE, something like this:

sumproduct((edate($P$8:$P,row($1:$13)) >= F$3)*(edate($P$8:$P,row($1:$13)) <= (F$4)))

This causes sumproduct to throw an error about array sizes not matching, because they don't. Anyone have any ideas how I can achieve what I'm after here? If more clarification is needed, please let me know.

Thanks in advance for any help!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi & welcome to MrExcel.
How about

+Fluff New.xlsm
ABCD
1First Invoice Due DateCompare Start DateCompare End DateSubsequent Invoice Due?
210/01/202012/03/202015/03/2020TRUE
315/01/202005/03/202007/03/2020FALSE
420/01/202017/03/202019/03/2020FALSE
530/01/202011/04/202016/04/2020TRUE
New project
Cell Formulas
RangeFormula
D2:D5D2=SUMPRODUCT((DAY($A$2:$A$5)>=DAY($B2))*(DAY($A$2:$A$5)<=DAY($C2)))>0
 
Upvote 0
Hi & welcome to MrExcel.
How about

+Fluff New.xlsm
ABCD
1First Invoice Due DateCompare Start DateCompare End DateSubsequent Invoice Due?
210/01/202012/03/202015/03/2020TRUE
315/01/202005/03/202007/03/2020FALSE
420/01/202017/03/202019/03/2020FALSE
530/01/202011/04/202016/04/2020TRUE
New project
Cell Formulas
RangeFormula
D2:D5D2=SUMPRODUCT((DAY($A$2:$A$5)>=DAY($B2))*(DAY($A$2:$A$5)<=DAY($C2)))>0
Hi Fluff -

Thanks so much for replying! I thought about doing things this way at first but months like february with an irregular number of days scared me off. Upon closer inspection, it looks like this will work perfectly. Really appreciate your help - thanks!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Hey Fluff -

So I just realized an issue with this formula. Say that my Compare Start date is 4/27/20 and my Compare End date is 5/3/2020. The original invoice date is 1/30/2020. In this case, I should get a "true" result, as the subsequent invoice date would be 4/30/2020, but the DAY() functions would return "27" and "3", thus returning a FALSE on the comparison as 30 is greater than 27 but not less than 3.

Thoughts here?
 
Upvote 0
I suspect there must be an easier way, but how about
=SUMPRODUCT((DATE(1,2,DAY($A$2:$A$5))>=DATE(1,IF(MONTH(C2)>MONTH(B2),1,2),DAY($B2)))*(DATE(1,2,DAY($A$2:$A$5))<=DATE(1,IF(MONTH(C2)>MONTH(B2),3,2),DAY($C2))))>0
 
Upvote 0
Thanks again for helping out.

Unfortunately, that doesn't seem to work either, as it returns several trues where there should be falses. Any other ideas? I can't seem to solve this problem!
 
Upvote 0
Can you please provide a sample using the XL2BB add-in, that shows the problems.
 
Upvote 0
Here you go:

Book1
ABCDEFGH
1First InvoiceAmountshould hit here only
22/14/20$2,000 Period 05Period 05Period 05Period 05
34/20/204/27/205/4/205/11/20
4Rent0200002000
Sheet1
Cell Formulas
RangeFormula
E4:H4E4=SUMPRODUCT(($B2:$B5)*(DATE(1,2,DAY($A$2:$A$5))>=DATE(1,IF(MONTH(E3+6)>MONTH(E3),1,2),DAY(E3)))*(DATE(1,2,DAY($A$2:$A$5))<=DATE(1,IF(MONTH(E3+6)>MONTH(E3),3,2),DAY(E3+6))))
 
Upvote 0
This has got absolutely nothing to do with your original question, so you will need to start a new thread.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top