Help returning value between certain dates

Dellboy

New Member
Joined
Sep 16, 2020
Messages
33
Office Version
  1. 365
Hello,

Hope some can help me.

I'm trying to create a formula that returns values between certain dates. It's been a while since I've used Excel and I'm strugglign at the moment.

See screenshot below if this was the raw data I would use;

1688935672171.png


Then, on this front sheet, I would like to return the values between the column E and F, in this instance, between 09/07/2023 and 11/07/23

1688935749691.png


Any help would be great appreciated.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Book1
ABCDEFG
1Date NewExpiry Date
209/07/202311/07/2023
3
4FruitCompanyOwnerActionDate NewExpiry
5AppleDellSamPurchase09/07/202311/07/2023
6AppleHPSamQuote16/07/202311/07/2023
7OrangeHPBobPurchase10/07/202311/07/2023
8
Sheet2
Cell Formulas
RangeFormula
B5:G7B5=FILTER(Sheet1!A2:F7,(Sheet1!E2:E7>=C2)*(Sheet1!F2:F7<=D2),"")
Dynamic array formulas.
 
Upvote 0
Thank you for this!

A couple of other things. Is it possible to filter the return values? i.e only return values for colums B,C,D and G? (not returning columns E and F).

Also, can I return the values based on a certain criteria, such as only returning values that have fruit as 'Apple' and 'Banana'.
 
Upvote 0
Trying the IF function, but doesn't seem to work.

Also, if I add Index function and use {2,3,4,7} columns doesn't return columns B,C,D,G
 
Upvote 0
Is it possible to filter the return values? i.e only return values for colums B,C,D and G? (not returning columns E and F).
Do you mean like this:
filter.xlsx
ABCDEF
1Date NewExpiry Date
209/07/202311/07/2023
3
4FruitCompanyOwnerExpiry
5AppleDellSam11/07/2023
6AppleHPSam11/07/2023
7OrangeHPBob11/07/2023
8
Sheet2
Cell Formulas
RangeFormula
B5:E7B5=FILTER(FILTER(Sheet1!A2:F7,(Sheet1!E2:E7>=C2)*(Sheet1!F2:F7<=D2),""),{1,1,1,0,0,1})
Dynamic array formulas.


You can probably tell within the braces {} which columns you want to return (1) and which you don't (0) :)
 
Upvote 0
hmm, that doesn't seem to work for me

When I try index at the start of the formula, then add {2,3,4,7}), it only returns one line
 
Upvote 0
Apologies, tried using index again.

Got the filter working, realised I needed to add 1,0,0,1 etc... for all the columns or else I got a value error. Thanks for this!

One final thing, and sorry to be a pain, how can I add a filter that only looks up the value of something specific, e.g, I only want to return 'Apple' from the table?
 
Upvote 0
No problem, you just add another criterion to the inner Filter function:
filter.xlsx
BCDE
1Date NewExpiry Date
209/07/202311/07/2023
3
4FruitCompanyOwnerExpiry
5AppleDellSam11/07/2023
6AppleHPSam11/07/2023
7
Sheet2
Cell Formulas
RangeFormula
B5:E6B5=FILTER(FILTER(Sheet1!A2:F7,(Sheet1!A2:A7="Apple")*(Sheet1!E2:E7>=C2)*(Sheet1!F2:F7<=D2),""),{1,1,1,0,0,1})
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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