Selected Answer
Nigel
In the revised sheet attached I've modified the code from Don's tutorial (already modified to give vertical headers following your previous question), I've taken the simple approach of replicating two portions of Don's code to define second variables (searchValue2 + fieldValue2) and then to get the array index to match those. Then it's a simple matter of changing the test (for matching values) to OR together the existing test with a check if the entry in position (i, searchField2) of dataArray matches searchValue2. Changes are shown in bold inthe code extract below (full code in the file again):
Sub Data_Search()
' TeachExcel.com
....
.... << code unchanged>>
....
'Get user input
searchValue = dashboard.Range("C4").Value
fieldValue = dashboard.Range("E4").Value
searchValue2 = dashboard.Range("C5").Value ' extra search value
fieldValue2 = dashboard.Range("E5").Value ' extra field definition
'Clear Dashboard
Call Clear_Data
'Figure out by which field we will search.
If (fieldValue = "ID") Then
searchField = 1
ElseIf (fieldValue = "Name") Then
searchField = 2
End If
'repeat for second parameters
If (fieldValue2 = "ID") Then
searchField2 = 1
ElseIf (fieldValue2 = "Name") Then
searchField2 = 2
End If
....
.... << code unchanged>>
....
'Check if the value in the row equals our search value
If (dataArray(i, searchField) = searchValue) Or (dataArray(i, searchField2) = searchValue2) Then
....
.... << code unchanged>>
....
End Sub
This should work well for two search pairs but, if you really need multple search pairs, a different approach is probably needed for code efficiency/ user experience (since it may become difficult for the user to differentiate why a given record is in the search results).
REVISION: Where large sets of data are used, the Transpose function may produce an error (where a sheet has null values or the search produces more than about 5k cells). In the revised sheet attached, Transpose is NOT used since the population of the data array is altered to anticipate horizontal data display. Note however that displaying a large amount of data horizontally (with vertical headers) will trigger an error if a dimension of the sheet (on an attempted copy) might exceed the maximum sheet size of 1,048,576 rows by 16,384 columns in versions of Excel after 2010 (cells beyond those limits just don't exist!). See Microsoft's guidance here: Excel specifications and limits.
The second file below (...with sheet names v0_c.xlsm) also adds the sheet name (from which a search column was obtained) in an additional row so you can better see where results are from. That row is in italics, with the Clear_Data macro modified to use .ClearContents (rather than .Clear) so that formatting remains. In this version, when each sheet if searched, the output array in limited by this additional test:
If nextColumn + LastRow < 16384 Then
'Transpose and increase size of array that will hold the data to display to its max possible size for the current worksheet.
ReDim datatoShowArray(1 To UBound(dataArray, 2) + 1, 1 To UBound(dataArray, 1) + 1)
Else
'Limit size of array to its max possible size for Excel
ReDim datatoShowArray(1 To UBound(dataArray, 2) + 1, 1 To (16384 - nextColumn))
End If
and if the actual search results would "break" Excel, it is stopped by this extra test within the worksheet search loop:
If j + nextColumn > 16384 Then
MsgBox "Unable to report sheet " & ws.Name & "- too many columns for Excel!"
Exit Sub
End If
The first sheet has 100,000 rows and will work with high numbers in an ID search (as sent)
Hope this works well for you.