Okay, after a lot of deadends, I decided hiding the rows that don't have data is the easiest way to go.
First, You don't need that second data table. I used this formula in your yellow table which can be dragged across and down
=IF(ISNUMBER(MATCH($I21,$D$1:$D$7,0)),VLOOKUP($I21,$I$2:$M$8,COLUMN(B1),FALSE),"")
Then it's necessary to write an event driven macro to hide rows that aren't being used.
Copy the code here into your spreadsheet. To do that;
1. Right click on the sheet tab and "View Code"
2. Paste the code into the large text box that is in the window that opens up (that window is the VBA Editor)
3. Close that window
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range, DataRng As Range
Set DataRng = Range("I21:I27")
Application.ScreenUpdating = False
If Not Intersect(Target, Range("D1:D7")) Is Nothing Then
For Each Cell In DataRng
If Cell.Value = "" Then
Cell.EntireRow.Hidden = True
ElseIf Cell.Value <> "" Then
Cell.EntireRow.Hidden = False
End If
Next Cell
End If
Application.ScreenUpdating = True
End Sub
Questions?
Bookmarks