I've had to get rid of your merged cells in columns A and B, and replace them with individual values in each cell. However, I've applied conditional formatting to the cells so that it looks very similar to what you had before. I've put this formula in K3 of the Database sheet:
=IF(OR('Interface sheet'!$B$4="",'Interface sheet'!$D$4=""),"-",IF(INDEX('Database sheet'!D:I,0,MATCH('Interface sheet'!$B$4,'Database sheet'!$D$1:$I$1,0)+MATCH('Interface sheet'!$D$4,'Database sheet'!$D$2:$E$2,0)-1)="x",MAX(K$2:K2)+1,"-"))
and copied this down beyond your data. This helper column identifies the records that match the criteria set on the Interface sheet and gives them a unique sequential number.
On the Output sheet I've set up a table below yours and put this formula in F19:
Formula:
=IFERROR(MATCH(ROWS($1:1),'Database sheet'!$K:$K,0),"-")
and copied it down. This determines the row(s) where the matching records occur on the Database sheet. Then I have this formula in A19:
Formula:
=IF(OR($F19="-",$F19=""),"",INDEX('Database sheet'!A:A,$F19))
which can be copied across into B19:C19 - it retrieves the appropriate data from the row given in column F. This row of formulae can then be copied down as far as you need.
I've also applied conditional formatting to the cells in columns A and B to try to mimic your merged cells. You can delete your example table on this sheet if you want to move the dynamic one further up - the formulae should adjust automatically.
I'm not sure why you have set it up with criteria in a different sheet - it is a bit awkward to go to the Interface sheet to set the criteria and then click on the Output sheet to see the results. You could easily put the drop-downs to set the criteria at the top of the Output sheet, so that you could see the results straightaway.
Anyway, hope this helps.
Pete
P.S. If that takes care of your original question, please select Thread Tools from the menu above your first post and mark this thread as SOLVED.
Also, since you are relatively new to the forum, I would like to inform you that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).
Pete
Bookmarks