return reference if in date period and 'yes'

mattbnorris

New Member
Joined
Sep 17, 2019
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
So I have a table with a list of loads of different references with dates assigned to them and also 'yes' or 'no' assigned to them. I need to return the reference numbers if the date is in a specific period and they have 'yes' assigned.

Example
[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Ref[/TD]
[TD]Status[/TD]
[TD][/TD]
[TD][/TD]
[TD]Jan-Mar 2019 & Yes[/TD]
[/TR]
[TR]
[TD]01/01/19[/TD]
[TD]#111[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[TD]#111[/TD]
[/TR]
[TR]
[TD]23/01/19[/TD]
[TD]#444[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[TD]#444[/TD]
[/TR]
[TR]
[TD]25/02/19[/TD]
[TD]#333[/TD]
[TD]No[/TD]
[TD][/TD]
[TD][/TD]
[TD]#222[/TD]
[/TR]
[TR]
[TD]01/01/19[/TD]
[TD]#222[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[TD]#555[/TD]
[/TR]
[TR]
[TD]07/03/19[/TD]
[TD]#555[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Similar concept to this one I helped you with. :)

Excel Workbook
ABCDEFGH
1DateRefStatusStart Month1List
21/01/2019#111YesEnd Month3#111
323/01/2019#444YesStatusYes#444
425/02/2019#333No#222
51/01/2019#222Yes#555
67/03/2019#555Yes
Date Yes
 
Upvote 0
Hi Peter, thanks for the help on this once again. Does this method work even with columns A, B and C in a different sheet or workbook?
 
Upvote 0
If you set up a fresh sheet exactly like the one in post 3 does it work?

Simply saying "its not working" gives us nothing to go on, especially when you can see the posted example is working.
When things don't work, you need to explain in what way they don't work (gives #REF ! error, Returns "x" instead of "y", crashes Excel etc) and give an example or two of sample data that it failed for.
 
Last edited:
Upvote 0
Give it a try? ;)

Hello again! I got something to work however now I want multiple status conditions to be picked up
Example

[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Ref[/TD]
[TD]Status[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Jan-Mar 19 "Active" & "Reactive" & "Yes"[/TD]
[/TR]
[TR]
[TD]15/01/19[/TD]
[TD]#111[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]#111[/TD]
[/TR]
[TR]
[TD]14/02/18[/TD]
[TD]#222[/TD]
[TD]No[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]#333[/TD]
[/TR]
[TR]
[TD]27/03/19[/TD]
[TD]#333[/TD]
[TD]Active[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]#444[/TD]
[/TR]
[TR]
[TD]30/01/19[/TD]
[TD]#444[/TD]
[TD]Reactive[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12/01/19[/TD]
[TD]#555[/TD]
[TD]No[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


I tried this but it doesn't seem to be working, is there a limit on the conditions I can have in there?

=INDEX(B$2:B$6,AGGREGATE(15,6,(ROW(B$2:B$6)-ROW(B$2)+1)/((MONTH(A$2:A$6)>=1)*(MONTH(A$2:A$6)<=3)*(C$2:C$6="Reactive")*(C$2:C$6="Active")*(C$2:C$6="Yes")*(YEAR(A$2:A$6)=2019)),ROWS(H$2:H2)))


This returns a #NUM ! error
 
Last edited:
Upvote 0
I tried this but it doesn't seem to be working, is there a limit on the conditions I can have in there?

=INDEX(B$2:B$6,AGGREGATE(15,6,(ROW(B$2:B$6)-ROW(B$2)+1)/((MONTH(A$2:A$6)>=1)*(MONTH(A$2:A$6)<=3)*(C$2:C$6="Reactive")*(C$2:C$6="Active")*(C$2:C$6="Yes")*(YEAR(A$2:A$6)=2019)),ROWS(H$2:H2)))
There is no practical limit to the number of conditions, however when multiplying the conditions like that it acts like AND. Of course a value in C2:C6 cannot be "Reactive" AND "Active" AND "Yes" at the same time.

Here is one way to do it.

Excel Workbook
ABCDEFGH
1DateRefStatusList
215/01/2019#111Yes#111
314/02/2018#222No#333
427/03/2019#333Active#444
530/01/2019#444Reactive
612/01/2019#555No
7
Date Yes (2)
 
Upvote 0
There is no practical limit to the number of conditions, however when multiplying the conditions like that it acts like AND. Of course a value in C2:C6 cannot be "Reactive" AND "Active" AND "Yes" at the same time.

Here is one way to do it.

Date Yes (2)

ABCDEFGH
RefStatus List
#111Yes #111
#222No #333
#333Active #444
#444Reactive
#555No

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:83px;"><col style="width:47px;"><col style="width:57px;"><col style="width:16px;"><col style="width:16px;"><col style="width:16px;"><col style="width:16px;"><col style="width:56px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="align: right"]Date[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: right"]15/01/2019[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: right"]14/02/2018[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: right"]27/03/2019[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="align: right"]30/01/2019[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="align: right"]12/01/2019[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
H2=IFERROR(INDEX(B$2:B$6,AGGREGATE(15,6,(ROW(B$2:B$6)-ROW(B$2)+1)/((MONTH(A$2:A$6)>=1)*(MONTH(A$2:A$6)<=3)*(ISNUMBER(MATCH(C$2:C$6,{"Reactive","Active","Yes"},0)))*(YEAR(A$2:A$6)=2019)),ROWS(H$2:H2))),"")

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


You clever clever man! Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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