Data lookup based upon date range

WORBY10

New Member
Joined
Sep 20, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I'm hoping someone can help me with a formula for the below example sheet please. I'm looking to create a report that shows specific data based upon a date range - what formula would I use for this? The ID number denotes the line on the data tab which needs to be looked at. I have put examples of the info I would expect to see when the date ranges changed.

If you need anymore info please let me know.

Thanks, James
Test Document.xlsx
ABCDE
1
2From Date01/01/2024
3To Date31/09/2024
4
5IDV1 COMMENTSREJECTION REASONV2 COMMENTSREJECTION REASON
6555624
7
8
9
10
11Expected results
12Date range set to 01/01/2024 to 20/09/2024
13IDV1 COMMENTSREJECTION REASONV2 COMMENTSREJECTION REASON
14555624Test commentIncorrect Colour
15
16
17Expected results
18Date range set to 01/01/2024 to 31/09/2024
19IDV1 COMMENTSREJECTION REASONV2 COMMENTSREJECTION REASON
20555624Test commentIncorrect ColourTest comment number 2Wrong Shape
21
22
23Expected results
24Date range set to 21/09/2024 to 31/09/2024
25IDV1 COMMENTSREJECTION REASONV2 COMMENTSREJECTION REASON
26555624Test comment number 2Wrong Shape
Report
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E25Cell Value=0textNO
E19Cell Value=0textNO
E13Cell Value=0textNO
E5Cell Value=0textNO
C1:C10,C13:C16,C19:C22,C25:C1048576Cell Value=0textNO



Main Sheet
1726832076676.png


Test Document.xlsx
ABCDEFGHIJKLM
1zDateIDPack_FormatOnline_Notes_Stage1_CommentsOnline_Notes_Stage1_Approval EditedOnline_Notes_Stage1_Rejection Type EditedOnline_Notes_Stage1_Rejection Type EditedOnline_Notes_Stage1_TimestampOnline_Notes_Stage2_CommentsOnline_Notes_Stage1_Approval EditedOnline_Notes_Stage2_Rejection Type EditedOnline_Notes_Stage1_Rejection Type EditedOnline_Notes_Stage1_Timestamp
219/09/2024555624BaseTest commentIncorrect Colour19/09/2024 10:34:44Test comment number 2Wrong Shape25/09/2024 13:34:44
Data


Data sheet
1726832135764.png


1726832156576.png
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You have to adjust the dates in these DATE() formulas manually unless you decide to place the dates in separate cells where they're easier to reference. You'll also need to adjust the data! ranges to match the number of rows you have, and I count at least 4 of them.

B14:
Excel Formula:
=LET(ID_row,FILTER(data!$A$2:$M$2,(data!$B$2=$A14)*(data!$H$2>=DATE(2024,1,1))*(data!$H$2<=DATE(2024,9,20)),""),IFERROR(CHOOSECOLS(ID_row,4,6), ""))

D14:
Excel Formula:
=LET(ID_row,FILTER(data!$A$2:$M$2,(data!$B$2=$A14)*(data!$M$2>=DATE(2024,1,1))*(data!$M$2<=DATE(2024,9,20)),""),IFERROR(CHOOSECOLS(ID_row,9,11), ""))

Copy those down to the rows below, adjust the dates, and I think it might work.
 
Upvote 0
On a side note regarding your request:
It seems that cell B3 ('To Date') does not contain an actual date, as it displays an invalid date '31-Sept' (September only has 30 days).
Therefore, it might be text, and Excel will interpret it as the next day, '1-Oct', which could lead to incorrect results.
Try to format the cell containing the date as 'Date' to avoid unnecessary errors
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,164
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