List Generator with index match within date range

dhubz

New Member
Joined
Sep 10, 2014
Messages
48
Office Version
  1. 2016
Platform
  1. Windows
Hello Eveyone,

I am trying to use an index match to generate a list, but I need to add a criteria for date range. The first sheet is a sample of the data table, on the second we enter the name and week ending date. It generates a list of worker hours based on the table entries. I need the index match formula to only return items within the range.

I need to add the date range portion to this formula
Excel Formula:
=IFERROR(INDEX(Table1[PF '#], MATCH(0, IF($B$3=Table1[Worker], COUNTIF($D$1:$D1,Table1[PF '#]), ""), 0)),"")

PREFAB DAILY WORK SHEET-SAMPLE FOR CODE.xlsx
ABCDEFGHIJ
1Column1PF #WO #Order#JOB NAMEDESCRIPTIONWorkerDateH0ursShipped
2Chad PoolPF00013C00201043Site#2Test Work #2Chad Pool10/10/20237
3Jane DoePF00012C00200002Site#1Test Work #1Jane Doe10/10/20232
4Chad PoolPF00022C01215051Site#11Test Work #11Chad Pool10/11/20231
5Jane DoePF00022C01215051Site#11Test Work #11Jane Doe10/11/20234.5
6Chad PoolPF00013C00201043Site#2Test Work #2Chad Pool10/11/20235.5
7John SmithPF00013C00201043Site#2Test Work #2John Smith10/11/20235.5
8Richard HertzPF00013C00201043Site#2Test Work #2Richard Hertz10/10/20235
9Richard HertzPF00014C00202001Site#3Test Work #3Richard Hertz10/10/20231.5
10Chad PoolPF00015C00203003Site#4Test Work #4Chad Pool10/10/20237
11John SmithPF00015C00203003Site#4Test Work #4John Smith10/12/20233.5
12Chad PoolPF00016C00204072Site#5Test Work #5Chad Pool10/10/20232
13Jane DoePF00016C00204072Site#5Test Work #5Jane Doe10/11/20233.5
14John SmithPF00017H00534029Site#6Test Work #6John Smith10/10/20234
15Jane DoePF00018H00535007Site#7Test Work #7Jane Doe10/10/20231
16John SmithPF00018H00535007Site#7Test Work #7John Smith10/06/20233.5
Daily Work Record
Cell Formulas
RangeFormula
C2:C16C2=IFERROR(VLOOKUP([@[PF '#]],Table2[#All],2,FALSE),"")
D2:D16D2=IFERROR(VLOOKUP([@[PF '#]],Table2[#All],3,FALSE),"")
E2:E16E2=IFERROR(VLOOKUP([@[PF '#]],Table2[#All],4,FALSE),"")
F2:F16F2=IFERROR(VLOOKUP([@[PF '#]],Table2[#All],5,FALSE),"")
A2:A16A2=[@Worker]
Cells with Data Validation
CellAllowCriteria
G3:G8List='Info DB'!$A$1:$A$9
G10:G11List='Info DB'!$A$1:$A$9
G13:G14List='Info DB'!$A$1:$A$9
G16List='Info DB'!$A$1:$A$9


PREFAB DAILY WORK SHEET-SAMPLE FOR CODE.xlsx
ABCDE
1Sunday, October 8, 2023Job #Hours
2Week Ending(mm/dd/yyyy)Saturday, October 14, 2023PF000135.5
3EmployeeJohn SmithPF000153.5
4Employee #7938PF000174
5Weekly Total13PF000180
6 0
7 0
8 0
Employee Weekly Totals
Cell Formulas
RangeFormula
B1B1=B2-6
D2:D8D2=IFERROR(INDEX(Table1[PF '#], MATCH(0, IF($B$3=Table1[Worker], COUNTIF($D$1:$D1,Table1[PF '#]), ""), 0)),"")
E2:E8E2=IFERROR(SUMIFS(Table1[H0urs],Table1[PF '#],'Employee Weekly Totals'!D2,Table1[Worker],$B$3,Table1[Date], ">="&$B$1,Table1[Date], "<="&$B$2),"")
B4B4=VLOOKUP(B3,'Info DB'!A:B,2,FALSE)
B5B5=SUM(E2:E23)
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Data Validation
CellAllowCriteria
B3:C3List='Info DB'!$A$1:$A$9
 

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.
To add a date range filter to your existing formula, assuming you want to filter based on the "start date" in cell A1 and the "end date" in cell B1, and the data is in a sheet named "Employee Weekly totals," you can modify the formula like this:

=IFERROR(INDEX('Employee Weekly totals'[PF '#], MATCH(0, IF($B$3='Employee Weekly totals'[Worker], ('Employee Weekly totals'[Date] >= $A$1) * ('Employee Weekly totals'[Date] <= $B$1) * (COUNTIF($D$1:$D1, 'Employee Weekly totals'[PF '#]) = 0), ""), 0)), "")

Here's how this modified formula works:

  1. ('Employee Weekly totals'[Date] >= $A$1) * ('Employee Weekly totals'[Date] <= $B$1): This part checks if the date in the "Date" column (adjust the column name as needed) is within the date range defined by cells A1 (start date) and B1 (end date). It returns 1 if the condition is met and 0 if not.
  2. The COUNTIF part ((COUNTIF($D$1:$D1, 'Employee Weekly totals'[PF '#]) = 0)) ensures that we only consider values in the "PF #" column that have not already been included in the result, based on your previous logic.
This modified formula will find the first unique "PF #" values from the "Employee Weekly totals" sheet for which the "Worker" matches the value in cell B3 and the "Date" falls within the date range specified in cells A1 and B1.
 
Upvote 0
I need the index match formula to only return items within the range.
See if this is what you want. Note that my dates are in d/m/y format.

dhubz_1.xlsm
BGH
1PF #WorkerDate
2PF00013Chad Pool10/10/2023
3PF00012Jane Doe10/10/2023
4PF00022Chad Pool11/10/2023
5PF00022Jane Doe11/10/2023
6PF00013Chad Pool11/10/2023
7PF00013John Smith11/10/2023
8PF00013Richard Hertz10/10/2023
9PF00014Richard Hertz10/10/2023
10PF00015Chad Pool10/10/2023
11PF00015John Smith12/10/2023
12PF00016Chad Pool10/10/2023
13PF00016Jane Doe11/10/2023
14PF00017John Smith10/10/2023
15PF00018Jane Doe10/10/2023
16PF00018John Smith6/10/2023
Daily Work Record


dhubz_1.xlsm
ABCD
18/10/2023Job #
2Week Ending(mm/dd/yyyy)14/10/2023PF00013
3EmployeeJohn SmithPF00015
4Employee #7938PF00017
5Weekly Total13 
6 
7 
8 
Employee Weekly Totals
Cell Formulas
RangeFormula
B1B1=B2-6
D2:D8D2=IFERROR(INDEX(Table1[PF '#],AGGREGATE(15,6,(ROW(Table1[PF '#])-ROW(Table1[#Headers]))/((Table1[Worker]=B$3)*(Table1[Date]>=B$1)*(Table1[Date]<=B$2)),ROWS(D$2:D2))),"")
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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