Return a value from a column, if date is between dates

Flagz

New Member
Joined
Apr 23, 2020
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hello there,

I have a sheet with 3 columns. A, B and C

1590686206224.png


I want a formula that I can type a start date and an end date, and it will return the Box number in Column C.
For example if I typed 10-Apr-2017 in E5 and 10-Nov-2018 in F5, starting in H5 and going down by rows
I would get 46,52,56 and 61 because those boxes contain paperwork between the dates searched.
This is what I have tried, but with no luck.

=IF(ROWS(A$2:B$150)>$G$5,"",INDEX(A$2:A$150,SMALL(IF(($A$2:$A$150>=$E$5)*($B$2:$B$150<=$F$5),ROW(A$2:$A$150)-ROW($A$2)+1),ROWS(H$5:H5))))

G5 =COUNTIFS(A2:A150,">="&E5,B2:B150,"<="&F5)

I placed the formula in H5 and hit enter. Cell is blank. Array entered, cell blank.
Not sure what is happening.
Any thoughts?
Thank you
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
How about
=IFERROR(INDEX($C$2:$C$7,AGGREGATE(15,6,(ROW($C$2:$C$7)-ROW($C$2)+1)/(($E$5<=$B$2:$B$7)*($F$5>=$A$2:$A$7)),ROWS(H$5:H5))),"")
 
Upvote 0
Your post suggests that the formula in G5 will return a count of 4. ROWS(A$2:B$150) will always be 149 regardless of what you do with it, so it will always be greater than the count and your formula will always result in a blank.

How about this one instead? Might need to array confirm.

=TEXTJOIN(", ",1,IF($A$2:$A$150<=F5,IF($B$2:$B$150>=F5,$C$2:$C$5,""),""))
 
Upvote 0
Did you try the alternative that I suggested?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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