If day (number) falls between two dates (month, day, year)

minigin

New Member
Joined
Jul 14, 2018
Messages
2
I'm working on an autopopulating weekly cash flow/forecasting spreadsheet and I need a formula to create entries if a date falls between two others.

For example, the electricity bill is due on the 13th, so if the date in H3 is 3/8/19, and the date in I3 is 3/15/19, the formula in H20 will determine if the due date falls between them and refer to a list of expenses another sheet and return the amount for that expense.

The problem is the due dates are listed as numbers, not dates. I don't know if I need to change the format or find the correct formula or both. I've tried extracting the day from the date in another row and using the median function to see if the due date falls between the two days, now formatted as numbers, but that doesn't always work correctly.

Here's a little more detail on how the sheet is set up:

Row 3 (D3:BC3) contains 52 dates (all Fridays) that autopopulate based on a manual date entry in cell D3.

Column B contains due dates for the expenses that are formatted as general numbers (1, 9, 22, etc.).

Row 7 returns the DAY of the dates from Row 3 =DAY(D3), formatted as general numbers. (I used this because I couldn't figure out how to use the due dates in the formula.)

I've tried using a median function that I cobbled together from trial and error and searching online, but it doesn't work in a few areas, including when the second date is on the first or at the beginning of the next month.
=IF($B$18=MEDIAN($B$18,D7,E7)OR(D7 > E7)AND(E7 > $B$18),Bills.$C$2,"'")

Not sure where to go from here. Probably something needs to be formatted differently or formulas adjusted, but I've reached my limit of knowledge and brain power. Any help is appreciated. Thanks.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try something like this...

=IF(OR(DATE(YEAR(D3),MONTH(D3),$B$18)=MEDIAN(DATE(YEAR(D3),MONTH(D3),$B$18),D3,E3-1),
DATE(YEAR(E3),MONTH(E3),$B$18)=MEDIAN(DATE(YEAR(E3),MONTH(E3),$B$18),D3,E3-1)),Bills!$C$2,"'")
 
Upvote 0
Try something like this...

=IF(OR(DATE(YEAR(D3),MONTH(D3),$B$18)=MEDIAN(DATE(YEAR(D3),MONTH(D3),$B$18),D3,E3-1),
DATE(YEAR(E3),MONTH(E3),$B$18)=MEDIAN(DATE(YEAR(E3),MONTH(E3),$B$18),D3,E3-1)),Bills!$C$2,"'")

Thank you SO MUCH! It worked perfectly! This really made my day, no, my year! I struggled trying to figure it out and I'm grateful for people like you that volunteer your time to help the rest of us as we learn. High fives and big hugs, thanks again!
 
Upvote 0

Forum statistics

Threads
1,223,708
Messages
6,174,006
Members
452,542
Latest member
Bricklin

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