Is there a better replacement for this formula?

AWM21

New Member
Joined
Aug 2, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello, I'm betting there is a better way to run this formula that references a block of dates by month, and returns the table rows based on the short date related to the selected month. In the example below, I have a dynamic array showcasing the rows of data from a table based on the month selected in the Orange data list. The data list looks at the month selected and references it to the starting date of that month. I then used EOMONTH to cross reference the table for anything less than, or equal to, the the associated month selected short date.

Here is the formula as it sits:
=FILTER(TROY,(TROY[Load Out Date]>=XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13))*(TROY[Load Out Date]<=EOMONTH(XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13),0)),"Currently No Events Scheduled")

The section of this formula that I believe can be simplified is:
(TROY[Load Out Date]>=XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13))*(TROY[Load Out Date]<=EOMONTH(XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13),0))

Is there a better way to extract the data by month instead of using this series of XLOOKUP references?
The "Month" & "Start" columns in the upper left only exist in order to work the XLOOKUP formula references. This can go away if that helps get a better solution.

Thanks!

Sample Data v1a.xlsx
ABCDEFGHIJKLMNO
1MonthStart
2January1/1/2022April$ 61,423.61
3February2/1/2022NameNumberParent NameAccount ManagerClientCompanyStatusPrep DateLoad Out DateReturn Date Total
4March3/1/2022Name_brP01-0065Parent_brRep_02Client_yCompany_yConfirmed4/1/20224/4/20224/5/2022$ 3,039.00
5April4/1/2022Name_oP01-0169Parent_oRep_03Client_jCompany_jTentative4/1/20224/5/20224/7/2022$ 1,119.36
6May5/1/2022Name_bfP01-0103Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 5,990.00
7June6/1/2022Name_bfP01-0111Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 7,460.00
8July7/1/2022Name_bfP01-0107Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 8,900.00
9August8/1/2022Name_bfP01-0086Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 34,915.25
10September9/1/2022
11October10/1/2022
12November11/1/2022
13December12/1/2022
14
15
16
17NameNumberParent NameAccount ManagerClientCompanyStatusPrep DateLoad Out DateReturn Date Total
18Name_aaP01-0046Parent_aaRep_06Client_oCompany_oInvoice Created1/1/20221/3/20221/3/2022$ 2,700.00
19Name_azP01-0026Parent_azRep_07Client_aCompany_aInvoice Created1/8/20221/11/20221/12/2022$ 33,200.00
20Name_qP01-0012Parent_qRep_02Client_qCompany_qInvoice Created1/6/20221/12/20221/17/2022$ 5,390.75
21Name_qP01-0011Parent_qRep_02Client_qCompany_qInvoice Created1/6/20221/12/20221/17/2022$ 51,987.80
22Name_qP01-0009Parent_qRep_02Client_qCompany_qInvoice Created1/6/20221/12/20221/17/2022$ 180,827.93
23Name_adP01-0048Parent_adRep_02Client_iCompany_iInvoice Created1/28/20222/1/20222/2/2022$ 11,260.00
24Name_akP01-0014Parent_akRep_02Client_eCompany_eInvoice Created1/27/20222/5/20222/8/2022$ 59,953.90
25Name_bnP01-0106Parent_bnRep_05Client_xCompany_xInvoice Created2/11/20222/11/20222/11/2022$ 800.00
26Name_biP01-0066Parent_biRep_05Client_gCompany_gInvoice Created2/7/20222/16/20222/17/2022$ 24,515.00
27Name_bkP01-0069Parent_bkRep_05Client_xCompany_xInvoice Created2/11/20222/16/20222/17/2022$ 29,603.75
28Name_acP01-0067Parent_acRep_02Client_iCompany_iInvoice Created2/2/20222/17/20222/17/2022$ 11,260.00
29Name_beP01-0070Parent_beRep_05Client_xCompany_xInvoice Created2/11/20222/17/20222/17/2022$ 16,723.00
30Name_uP01-0153Parent_uRep_04Client_vCompany_vConfirmed3/11/20223/14/20223/15/2022$ 2,936.00
31Name_sP01-0181Parent_sRep_07Client_aCompany_aInvoice Created3/15/20223/16/20223/16/2022$ 2,478.50
32Name_bhP01-0120Parent_bhRep_05Client_xCompany_xConfirmed3/11/20223/16/20223/17/2022$ 50,458.75
33Name_bhP01-0184Parent_bhRep_05Client_xCompany_xConfirmed3/11/20223/16/20223/17/2022$ 367.50
34Name_bhP01-0187Parent_bhRep_05Client_xCompany_xConfirmed3/11/20223/16/20223/17/2022$ -
35Name_arP01-0098Parent_arRep_05Client_uCompany_uConfirmed2/4/20223/31/20224/1/2022$ 11,838.00
36Name_brP01-0065Parent_brRep_02Client_yCompany_yConfirmed4/1/20224/4/20224/5/2022$ 3,039.00
37Name_oP01-0169Parent_oRep_03Client_jCompany_jTentative4/1/20224/5/20224/7/2022$ 1,119.36
38Name_bfP01-0103Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 5,990.00
39Name_bfP01-0111Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 7,460.00
40Name_bfP01-0107Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 8,900.00
41Name_bfP01-0086Parent_bfRep_05Client_xCompany_xConfirmed2/7/20224/8/20224/6/2022$ 34,915.25
42Name_baP01-0104Parent_baRep_02Client_yCompany_yTentative5/11/20225/12/20225/13/2022$ 12,675.50
43Name_ajP01-0177Parent_ajRep_05Client_xCompany_xTentative5/13/20225/18/20225/19/2022$ 48,718.75
44Name_auP01-0061Parent_auRep_05Client_abCompany_abConfirmed5/12/20225/18/20225/23/2022$ 52,250.25
45Name_blP01-0202Parent_blRep_05Client_xCompany_xInquiry5/17/20225/20/20225/23/2022$ -
46Name_auP01-0175Parent_auRep_05Client_abCompany_abConfirmed5/12/20225/23/20225/23/2022$ 3,900.00
47Name_iP01-0209Parent_iRep_04Client_sCompany_sInquiry5/20/20225/26/20225/27/2022$ 35,133.50
48Name_agP01-0186Parent_agRep_02Client_yCompany_yConfirmed5/20/20225/26/20225/30/2022$ 12,493.00
49Name_ahP01-0150Parent_ahRep_02Client_yCompany_yInquiry5/20/20225/26/20225/30/2022$ 92,953.75
50Name_rP01-0033Parent_rRep_02Client_qCompany_qConfirmed6/9/20226/15/20226/17/2022$ 6,564.50
51Name_rP01-0032Parent_rRep_02Client_qCompany_qConfirmed6/9/20226/15/20226/17/2022$ 29,042.40
52Name_rP01-0029Parent_rRep_02Client_qCompany_qConfirmed6/9/20226/15/20226/17/2022$ 189,669.75
53Name_aiP01-0031Parent_aiRep_02Client_qCompany_qTentative9/14/20229/23/20229/27/2022$ 1,950.00
54Name_aiP01-0136Parent_aiRep_02Client_qCompany_qInquiry9/14/20229/23/20229/27/2022$ 10,440.50
55Name_aiP01-0140Parent_aiRep_02Client_qCompany_qInquiry9/14/20229/23/20229/27/2022$ 10,440.50
56Name_aiP01-0137Parent_aiRep_02Client_qCompany_qInquiry9/14/20229/23/20229/27/2022$ 10,440.50
57Name_aiP01-0141Parent_aiRep_02Client_qCompany_qInquiry9/14/20229/23/20229/27/2022$ 10,440.50
58Name_aiP01-0143Parent_aiRep_02Client_qCompany_qInquiry9/14/20229/23/20229/27/2022$ 10,440.50
59Name_anP01-0190Parent_anRep_05Client_mCompany_mInquiry8/1/202211/14/202211/14/2022$ 113,300.00
60Name_anP01-0192Parent_anRep_05Client_mCompany_mInquiry8/1/202211/14/202211/14/2022$ 115,850.00
61Name_anP01-0189Parent_anRep_05Client_mCompany_mInquiry8/1/202211/14/202211/14/2022$ 116,700.00
62Name_anP01-0191Parent_anRep_05Client_mCompany_mInquiry8/1/202211/14/202211/14/2022$ 119,100.00
63Name_apP01-0089Parent_apRep_04Client_lCompany_lInquiry11/14/202212/26/202212/30/2022$ 56,956.00
64Name_apP01-0088Parent_apRep_04Client_lCompany_lInquiry11/14/202212/26/202212/30/2022$ 114,369.00
Quotes_P01
Cell Formulas
RangeFormula
O2O2=SUMIFS(TROY[Total],TROY[Load Out Date],">="&XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13),TROY[Load Out Date],"<="&EOMONTH(XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13),0))
E4:O9E4=FILTER(TROY,(TROY[Load Out Date]>=XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13))*(TROY[Load Out Date]<=EOMONTH(XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13),0)),"Currently No Events Scheduled")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
E2List=$A$2:$A$13
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You can streamline your existing approach ..
Excel Formula:
=FILTER(TROY,(TROY[Load Out Date]>=XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13))*(TROY[Load Out Date]<=EOMONTH(XLOOKUP($E$2,$A$2:$A$13,$B$2:$B$13),0)),"Currently No Events Scheduled")
.. a little by employing the LET function & ditching the absolute references.
Excel Formula:
=LET(XL,XLOOKUP(E2,A2:A13,B2:B13),LOD,TROY[Load Out Date],FILTER(TROY,(LOD>=XL)*(LOD<=EOMONTH(XL,0)),"Currently No Events Scheduled"))

If all your dates are in the same year then you could use this
Excel Formula:
=FILTER(TROY,TEXT(TROY[Load Out Date],"mmmm")=E2,"Currently No Events Scheduled")

If dates span multiple years than a modification would be needed. Post back with more details/sample if this is the case and you want more help.
 
Upvote 0
Solution
Thanks Peter! I see what you mean about the year. If this document lives that long, I'll worry about it then. I told my colleague that, for what he is asking for in the overall document, he is getting into Sales Force or Power BI territory.
I didnt think to use LET like that.
Thanks again Peter, I really appreciate the help here. Have a great rest of your weekend! :)
 
Upvote 0
You're welcome. Hope it all works out for you. :)
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,138
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