This isn't the most dynamic or elegant solution, but it should do the job for your current set-up. A formula for 'Master Sheet'!E2
that (I think) does what you want is this (a formula without structured references and named ranges is below).
The only deficiency I can think of here, is if you delete a row from the master sheet, that won't trigger the deletion of that particular row's notes cell in the filtered sheets, and so then the "notes" that you'd get would be off by one, since now a new ID is where that old ID was in the filtered sheet, but the new ID still has the old notes. I don't think there is a way to handle that particular scenario (at least, not without VBA), so I'd use this approach to get the master sheet cleaned up, and then use the master sheet, with filters, to do any future edits to notes and removals from the master list.
=IF(
[@admission] = "accept",
INDEX(
Filter_Accepted!$1:$1048576,
MATCH(
[@id],
INDEX(
Accepted#,
0,
1
)
,0
)+1,
5
),
INDEX(
Filter_Rejected!$1:$1048576,
MATCH(
[@id],
INDEX(
Rejected#,
0,
1
),
0
)+1,
5
)
)
Basically, we use an IF
to search one of the two sheets, and use INDEX
along with MATCH
to get the cell that has the information we want. You can jump down to the bottom for a commented version that explains what the bits and pieces are doing.
You'll also notice I've got structured references and named cell ranges in here. [@admission]
could be replaced with a relative reference to D2
, [@id]
could be replaced with a relative reference to A2
, and the Accepted#
and Rejected#
named references could be replaced by Filter_Accepted:$A$2#
and Filter_Rejected:$A$2#
, respectively.
That formula would look like this:
=IF(
D2 = "accept",
INDEX(
Filter_Accepted!$1:$1048576,
MATCH(
A2,
INDEX(
Filter_Accepted!$A$2#,
0,
1
),
0
)+1,
5
),
INDEX(
Filter_Rejected!$1:$1048576,
MATCH(
A2,
INDEX(
Filter_Rejected!$A$2#,
0,
1
),
0
)+1,
5
)
)
Explanation of Formula
=IF(
' Check whether master table admission column, for this row (@), is accept
[@admission] = "accept",
' it is accept. Use INDEX to get the cell with the notes for
' this row's id
INDEX(
' search the entire Filter_Accepted sheet
Filter_Accepted!$1:$1048576,
' find the row of the Filter_Accepted sheet that has the relevant ID.
MATCH(
' the ID we're searching for.
[@id],
' where we're searching for that ID. In this case,
' we're looking at all rows (0), of the first column (1),
' of the dynamic array returned by the `FILTER` for accept.
INDEX(
Accepted#,
0,
1
)
' Exact match (0)
,0
' the row number we get will be off by one,
' since the `FILTER` dynamic array is in Filter_Accepted:$A$2.
' so, add 1 to get the right row number for the whole sheet.
)+1,
' we want the fifth column of the Filter_Accepted sheet, since
' that's the one that has the notes.
5
),
' it is not accept, so it must be reject
INDEX(
' same story as above, just for the Filter_Rejected sheet
' and the dynamic array from the `FILTER` for reject.
Filter_Rejected!$1:$1048576,
MATCH(
[@id],
INDEX(
Rejected#,
0,
1
),
0
)+1,
5
)
)
Example File
Can be found here: https://www.dropbox.com/s/5anilsphdlloh60/superuser-1716190.xlsx?dl=0 (both versions of the formula should work)