Retrieve only dates within a specific month

qwzky

Board Regular
Joined
Jul 22, 2021
Messages
53
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Hello! In range S6:S22 there are some random dates of user input. I want the dates within September to be retrieved in range T6:T22 (unfilled cells should remain empty: "", without showing any error). Is there a formula to do this, without getting VBA involved?



PCO final3.xlsx
ST
5Generalseptembrie
604.06.202304.06.2023
7 
816.09.202316.09.2023
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
Data
Cell Formulas
RangeFormula
T6:T22T6=FILTER(S6:S22,PCO!C4)
S6:S22S6=IF(PCO!$D10="","",PCO!$D10)
Dynamic array formulas.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try this ...

The month column (Column T) contains a date and formatted as "mmmm" (to display the full month name).
The formula matches the Month (numerical value) with the month of the values in Column S.

RotatingWorkDay.xlsm
ST
1GeneralSeptember
24/6/2023 
3 
49/16/20239/16/2023
5 
6 
7 
85/1/2023 
9 
10 
11 
129/27/20239/27/2023
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
Sheet1
Cell Formulas
RangeFormula
T2:T22T2=IF(S2=0,"",IF(MONTH(S2)=MONTH(T$1),S2,""))


Here is a test with the date in T1 changed to April 1, 2023 (4/1/2023)
RotatingWorkDay.xlsm
ST
1GeneralApril
24/6/20234/6/2023
3 
49/16/2023 
5 
6 
7 
85/1/2023 
9 
10 
11 
129/27/2023 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
Sheet1
Cell Formulas
RangeFormula
T2:T22T2=IF(S2=0,"",IF(MONTH(S2)=MONTH(T$1),S2,""))
 
Upvote 0
Try this ...

The month column (Column T) contains a date and formatted as "mmmm" (to display the full month name).
The formula matches the Month (numerical value) with the month of the values in Column S.

RotatingWorkDay.xlsm
ST
1GeneralSeptember
24/6/2023 
3 
49/16/20239/16/2023
5 
6 
7 
85/1/2023 
9 
10 
11 
129/27/20239/27/2023
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
Sheet1
Cell Formulas
RangeFormula
T2:T22T2=IF(S2=0,"",IF(MONTH(S2)=MONTH(T$1),S2,""))


Here is a test with the date in T1 changed to April 1, 2023 (4/1/2023)
RotatingWorkDay.xlsm
ST
1GeneralApril
24/6/20234/6/2023
3 
49/16/2023 
5 
6 
7 
85/1/2023 
9 
10 
11 
129/27/2023 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
Sheet1
Cell Formulas
RangeFormula
T2:T22T2=IF(S2=0,"",IF(MONTH(S2)=MONTH(T$1),S2,""))
It doesn't work :( Look here what it gives me:

Cell Formulas
RangeFormula
S6:S22S6=IF(PCO!$D10="","",PCO!$D10)
T6:T22T6=IF(S6=0,"",IF(MONTH(S6)=MONTH(T$6),S6,""))
 
Upvote 0
Your Office Version(s) shown are 2016, 2013 yet one formula shown has a FILTER function. FILTER is not introduced until 2021. What versions does this need to work with?
 
Upvote 0
oh, i forgot to update my profile. I have 2021
 
Upvote 0
Editied: mistake in the formula and cell reference. Corrected here.

With 9/1/2023 in S4 this in T6 and copied down.
Excel Formula:
=IF(INDEX(FREQUENCY(S6,EOMONTH($S$4,{-1,0})),2),S6,"")
 
Last edited:
Upvote 0
oh, i forgot to update my profile. I have 2021
Thank you. Our posts crossed in the ether. Does my formula in my previous post work for you? If not do you still want a FILTER solution?
Editied: mistake in the formula and cell reference. Corrected here.

With 9/1/2023 in S4 this in T6 and copied down.
Excel Formula:
=IF(INDEX(FREQUENCY(S6,EOMONTH($S$4,{-1,0})),2),S6,"")
For a FILTER solution with 9/1/2023 in S4 this in T6
Excel Formula:
=FILTER(S6:S22,(S6:S22>EOMONTH(S4,-1))*(S6:S22<=EOMONTH(S4,0)))
it should spill all relevant dates.
 
Upvote 0
Solution
Thank you. Our posts crossed in the ether. Does my formula in my previous post work for you? If not do you still want a FILTER solution?

For a FILTER solution with 9/1/2023 in S4 this in T6
Excel Formula:
=FILTER(S6:S22,(S6:S22>EOMONTH(S4,-1))*(S6:S22<=EOMONTH(S4,0)))
it should spill all relevant dates.
This works brilliantly :) Love it. Thank you, thank you, thank you :)
 
Last edited:
Upvote 0
It doesn't work :( Look here what it gives me:

Cell Formulas
RangeFormula
S6:S22S6=IF(PCO!$D10="","",PCO!$D10)
T6:T22T6=IF(S6=0,"",IF(MONTH(S6)=MONTH(T$6),S6,""))
You did not set the column header (e.g. September) to a date value. And format the column header as a custom format "mmmm".
That is why the error was generated.
 
Upvote 0

Forum statistics

Threads
1,224,750
Messages
6,180,740
Members
452,996
Latest member
nelsonsix66

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