Using FILTER to spill with certain criteria

rizzo93

Active Member
Joined
Jan 22, 2015
Messages
301
Office Version
  1. 365
I'm using a formula to spill values from a column in a table on one worksheet to another column on another worksheet.

The table and column is called tblActiveProjects[Go Live Date]. I want to spill the values that meet the following criteria:
  • the month of the value in [Go Live Date] IS NOT less than the month of Today
  • the year of the value in [Go Live Date] IS EQUAL to the year of Today
  • the value in [Go Live Date] IS NOT equal to "TBD"
This is what I have so far, but it's only producing a #VALUE error:

Excel Formula:
=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(MONTH(tblActiveProjects[Go Live Date])<MONTH(TODAY()))*(YEAR(tblActiveProjects[Go Live Date]=YEAR(TODAY()))))

If I leave it at just not equaling TBD, I'm fine, but when I get into the month and year stuff, that's where it breaks down.

Is what I want possible?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I think when a TBD text is put into the 'go live date', it throws the error in the month function, breaking the formula.
 
Upvote 0
James is right...I suppose you could trap the error, maybe like this:
Book1
ABC
31/15/2022Go Live Date
43/15/20221/15/2022
55/15/20223/15/2022
62/13/20225/15/2022
76/15/2022
87/15/2022
9TBD
108/15/2022
112/13/2022
Sheet2
Cell Formulas
RangeFormula
A3:A6A3=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(IF(ISERROR(MONTH(tblActiveProjects[Go Live Date])),"",MONTH(tblActiveProjects[Go Live Date]))<MONTH(TODAY()))*(YEAR(tblActiveProjects[Go Live Date]=YEAR(TODAY()))))
Dynamic array formulas.
 
Upvote 0
Thanks, James and KRice.

Yeah, I should have said Month of value is >= to Month of Today.

When I used KRice's formula and made the change to the Month portion, it did spill the dates, but not exactly filtered as expected.

Excel Formula:
=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(IF(ISERROR(MONTH(tblActiveProjects[Go Live Date])),"",MONTH(tblActiveProjects[Go Live Date]))>=MONTH(TODAY()))*(YEAR(tblActiveProjects[Go Live Date]=YEAR(TODAY()))))

The values in my source are:
6/8/21
12/10/21
4/12/22
5/16/22
6/10/22
6/13/22
6/13/22
6/15/22
6/20/22
6/30/22
7/1/22
7/26/22
10/31/22
TBD
TBD

(I may have to just replace TBD with blanks.)

These are the results of the formula:
6/8/21
12/10/21

6/10/22
6/13/22
6/13/22
6/15/22
6/20/22
6/30/22
7/1/22
7/26/22
10/31/22

The dates in red should not show up, but I don't understand why they're not filtering out when the other two dates did.

Any thoughts?
 
Upvote 0
That's better yet, Fluff...leaving only one issue to resolve regarding the discrepancy between the initial statement and formula.
 
Upvote 0
If you are trying to get all dates from this month onwards how about
Excel Formula:
=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(tblActiveProjects[Go Live Date]>EOMONTH(TODAY(),-1)))
 
Upvote 0
Solution
If you want just this year from this month on
Excel Formula:
=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(tblActiveProjects[Go Live Date]>EOMONTH(TODAY(),-1))*(tblActiveProjects[Go Live Date]<DATE(YEAR(TODAY())+1,1,1)))

That's better yet, Fluff
I deleted my previous reply, as it was wrong. :(
 
Upvote 0
I missed something earlier in Post #1...I just noticed there is a misplaced right parentheses that never properly closes the YEAR function operating on [Go Live Date]. Not that it matter because "TBD" throws an error in the YEAR function too, so Fluff's idea to avoid MONTH and YEAR being applied to [Go Live Date] makes more sense.
 
Upvote 0
To follow up, I believe the answer to the earlier question about those other dates showing is because I carried the misplaced right parentheses through in my answer...and that's not correct. Extracting just that portion, I had
Excel Formula:
YEAR(tblActiveProjects[Go Live Date]=YEAR(TODAY()))
...which evaluates to {1900;1900;1900;1900;1900;1900;1900;1900;1900;1900;1900;1900;1900;1900;1900}.
So to follow the error trapping approach, another clunky IF statement would be used for the YEAR function as shown in B3. But Fluff's formula in C3 is a better way to go.
Book1
ABCDE
2Post #4 (incorrect)Error trappedFluff's post #8Go Live Date
36/8/20216/10/20226/10/20226/8/2021
412/10/20216/13/20226/13/202212/10/2021
56/10/20226/13/20226/13/20224/12/2022
66/13/20226/15/20226/15/20225/16/2022
76/13/20226/20/20226/20/20226/10/2022
86/15/20226/30/20226/30/20226/13/2022
96/20/20227/1/20227/1/20226/13/2022
106/30/20227/26/20227/26/20226/15/2022
117/1/202210/31/202210/31/20226/20/2022
127/26/20226/30/2022
1310/31/20227/1/2022
147/26/2022
1510/31/2022
16TBD
17TBD
Sheet2
Cell Formulas
RangeFormula
A3:A13A3=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(IF(ISERROR(MONTH(tblActiveProjects[Go Live Date])),"",MONTH(tblActiveProjects[Go Live Date]))>=MONTH(TODAY()))*(YEAR(tblActiveProjects[Go Live Date]=YEAR(TODAY()))))
B3:B11B3=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(IF(ISERROR(MONTH(tblActiveProjects[Go Live Date])),"",MONTH(tblActiveProjects[Go Live Date]))>=MONTH(TODAY()))*(IF(ISERROR(YEAR(tblActiveProjects[Go Live Date])),"",YEAR(tblActiveProjects[Go Live Date]))=YEAR(TODAY())))
C3:C11C3=FILTER(tblActiveProjects[Go Live Date],(tblActiveProjects[Go Live Date]<>"TBD")*(tblActiveProjects[Go Live Date]>EOMONTH(TODAY(),-1))*(tblActiveProjects[Go Live Date]<DATE(YEAR(TODAY())+1,1,1)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,073
Members
449,205
Latest member
Healthydogs

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