Array formula to list data if MONTH and DAY fall between two dates

SevenOut

Board Regular
Joined
Jan 7, 2020
Messages
82
Office Version
  1. 2013
Platform
  1. Windows
I have a workbook with two worksheets.
Sheet1 has a beginning date in D3 and an ending date in J3. (Schedule starting with Sat and ending with Fri).
Sheet2 has a list of birthdates. NAMES are A3:A47 and BIRTHDATES are B3:B47

So, my previous experience I've managed to work an array formula that would list the names and dates of birthdays for the current month. I'm having difficulty however adjusting the formula to find the names/dates if the month and day of Sheet2!B3:B47 fall between Sheet1!D3 and Sheet1!J3.

VBA Code:
=IFERROR(INDEX($A$3:$A$47,SMALL(IF(MONTH($B$3:$B$47)=MONTH(Sheet1!$D$3),ROW($A$3:$A$47)-ROW($A$3)+1),ROWS($1:1))),"")
This formula for example, will only return data for the month of date in Sheet1!D3.

I do hope my explanation is clear, an example sheet can be worked up if needed.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Try
Book1
DEFGHIJ
32/1/20202/7/2020
4
5
6name7
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
Sheet1
Cell Formulas
RangeFormula
E6:E17E6{=IF(ROWS(E$6:E6)>SUMPRODUCT(($D$3<=Sheet2!$B$3:$B$47)*(Sheet1!J3>=Sheet2!B3:B47)),"",INDEX(Sheet2!$A$3:$A$47,SMALL(IF(Sheet2!$B$3:$B$47>=Sheet1!$D$3,IF(Sheet2!$B$3:$B$47<=Sheet1!$J$3,ROW(Sheet2!$A$3:$A$47)-ROW(Sheet2!$A$3)+1)),ROWS(E$6:E6))))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0
Scott T, thank you for the response. The formula does not provide a result however. There should be two Names returned.
 
Upvote 0
The workbook provided, there are two birthdays on 2/5 (Feb 5th) which fall between dates 2/1 and 2/7. The formula provides zero returns however. I will upload a version with the formulas added, perhaps I've done something wrong
 
Upvote 0
schedule: February
Birthdays: only one February is there
feb.png


if you want compare Months and Days - result will be Nothing (0)
and I am not saying about formula

@post#7
what's the differences with post#3 ?
 
Upvote 0
Try
using 2/15-2/21 as the date range
Book1
ABCDEF
2NameDateNameDate
3name11/1/1997name72/17/1995
4name21/2/1950name172/20/1970
5name33/5/1970name232/16/1980
6name411/20/1980  
7name56/10/1960  
8name62/2/1980  
9name72/17/1995  
10name89/22/1970  
11name96/9/1966  
12name107/7/1977  
13name119/1/1997  
14name122/28/1980  
15name135/2/1976  
16name1412/20/1976  
17name1511/27/1974
18name167/21/1973
19name172/20/1970
20name182/8/1975
21name191/30/1973
22name205/3/1978
23name213/21/1974
24name2210/12/1977
25name232/16/1980
26name246/1/1977
27name258/25/1979
28name264/9/1973
29name275/27/1974
30name286/13/1970
31name292/3/1974
32name303/15/1974
33name318/6/1970
34name3210/29/1973
35name3312/14/1977
36name344/24/1974
37name353/25/1978
38name363/2/1975
39name372/7/1994
40name381/30/1988
41name397/9/1979
42name4012/4/1991
43name419/30/1977
44name421/30/1975
45name437/7/1999
46name445/5/1966
47name454/4/1969
Sheet2
Cell Formulas
RangeFormula
E3:E16E3{=IF(ROWS(E$3:E3)>SUMPRODUCT((DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))>=Sheet1!$D$3)*(DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))<=Sheet1!$J$3)),"",INDEX($A$3:$A$47,SMALL(IF(DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))>=Sheet1!$D$3,IF(DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))<=Sheet1!$J$3,ROW(Sheet2!$A$3:$A$47)-ROW(Sheet2!$A$3)+1)),ROWS(E$3:E3))))}
F3:F16F3{=IF(ROWS(E$3:E3)>SUMPRODUCT((DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))>=Sheet1!$D$3)*(DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))<=Sheet1!$J$3)),"",INDEX($B$3:$B$47,SMALL(IF(DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))>=Sheet1!$D$3,IF(DATE(YEAR(TODAY()),MONTH($B$3:$B$47),DAY($B$3:$B$47))<=Sheet1!$J$3,ROW(Sheet2!$A$3:$A$47)-ROW(Sheet2!$A$3)+1)),ROWS(E$3:E3))))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Last edited:
Upvote 0
There are two Feb. Birthdates, 2/5/74 and 2/5/65 (Name7 and Name8) 1/2/1950 is Jan 2nd.
Scott T, I'll try again this evening :)
 
Upvote 0

Forum statistics

Threads
1,216,131
Messages
6,129,066
Members
449,485
Latest member
greggy

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