Reputation: 1045
given the data below, I would like to create an Excel formula that returns all of the red product IDs whose sales occurred between Jan 4 and Jan 18.
Color | Date | Product |
---|---|---|
Blue | 1/1/2021 | ABC123 |
Red | 1/1/2021 | ABC124 |
Blue | 1/3/2021 | ABC125 |
Red | 1/4/2021 | ABC126 |
Blue | 1/5/2021 | ABC127 |
Red | 1/6/2021 | ABC128 |
Blue | 1/6/2021 | ABC129 |
Red | 1/8/2021 | ABC130 |
Blue | 1/8/2021 | ABC131 |
Red | 1/10/2021 | ABC132 |
Blue | 1/10/2021 | ABC133 |
Red | 1/12/2021 | ABC134 |
Blue | 1/13/2021 | ABC135 |
Red | 1/13/2021 | ABC136 |
Blue | 1/15/2021 | ABC137 |
Red | 1/16/2021 | ABC138 |
Blue | 1/16/2021 | ABC139 |
Red | 1/18/2021 | ABC140 |
Blue | 1/19/2021 | ABC141 |
Red | 1/20/2021 | ABC142 |
So, that should return:
Product |
---|
ABC126 |
ABC128 |
ABC130 |
ABC132 |
ABC134 |
ABC136 |
ABC138 |
ABC140 |
I prefer not use any VBA for this project.
Upvotes: 0
Views: 741
Reputation: 1045
For those of us that don't have filter(), I was able to find the answer here:
So, for my worksheet, the function for returning the column of identifiers looks like this:
=INDEX($C$2:$C$21, SMALL(IF(COUNTIF($A$3,$A$2:$A$21)*($B$2:$B$21<=$B$19)*($B$2:$B$21>=$B$5), ROW($A$2:$A$21)-MIN(ROW($A$2:$A$21))+1), ROW(A1)), COLUMN(A1))
This should be entered as an array function and then dragged down to see all the matches.
Upvotes: 0
Reputation: 152450
If one has FILTER():
=FILTER(C:C,(A:A="Red")*(B:B>=--"1/4/2021")*(B:B<=--"1/18/2021"))
Upvotes: 2