Two Dates are within a month

_eNVy_

Board Regular
Joined
Feb 9, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
I need to identify whether two dates (Start and End) fall within any months from 01 April 2021 to 30 September 2022

Some of the End Dates are blank which shows that particular record is still active.

Example
Just a small look into the columns.
Apologies, don't know how to increase the number of columns in the below table. Also added a quick picture of what I want the results to look like.

Start DateEnd DateApr 21May 21Jun 21Jul 21Aug 21Sep 21Oct 21Nov 21
05/10/202005/10/202111111110

The above shows that because the record was active between 05/10/2020 and 05/10/2021 that the months Apr 21 to Oct 21 will show a 1 and months after will be a 0.

If the above's End Date was blank, then months after Oct 21 will also be 1.

Hope this makes sense.
 

Attachments

  • Example Pic.png
    Example Pic.png
    28.1 KB · Views: 13

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
this should work for you. i extended it to the end of 2022
-------------
if Two Dates are within a month.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1start dateend dateApr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
27/28/20218/24/2021000110000000000000000
31/20/2021111111111111111111111
44/6/2020111111111111111111111
510/5/202012/5/2021111111111000000000000
612/6/2021000000001111111111111
79/7/2020111111111111111111111
84/8/2013111111111111111111111
93/1/20214/11/2021100000000000000000000
104/11/2021111111111111111111111
114/3/20215/13/2021110000000000000000000
Sheet1
Cell Formulas
RangeFormula
C2:W11C2=IF(OR(AND(C$1>=$A2,C$1<=IF($B2="",MAX(TODAY(),C$1),$B2)),AND(DATE(YEAR(C$1),MONTH(C$1)+1,DAY(C$1)-1)>=$A2,C$1<=IF($B2="",MAX(TODAY(),C$1),$B2))),1,0)
 
Upvote 0
Solution
this should work for you. i extended it to the end of 2022
-------------
if Two Dates are within a month.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1start dateend dateApr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
27/28/20218/24/2021000110000000000000000
31/20/2021111111111111111111111
44/6/2020111111111111111111111
510/5/202012/5/2021111111111000000000000
612/6/2021000000001111111111111
79/7/2020111111111111111111111
84/8/2013111111111111111111111
93/1/20214/11/2021100000000000000000000
104/11/2021111111111111111111111
114/3/20215/13/2021110000000000000000000
Sheet1
Cell Formulas
RangeFormula
C2:W11C2=IF(OR(AND(C$1>=$A2,C$1<=IF($B2="",MAX(TODAY(),C$1),$B2)),AND(DATE(YEAR(C$1),MONTH(C$1)+1,DAY(C$1)-1)>=$A2,C$1<=IF($B2="",MAX(TODAY(),C$1),$B2))),1,0)
Thank you very much! This worked a treat!
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

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