I am going through this book page-by-page and using the examples to create my own personal file. The copyright on my version is 2009, so this may be a moot point due to updated versions.
On page 53: Looking at the definitions in the formula below I believe the underscore should be eliminated for the formula to work - I had to drop it.
Function VLOOKUPNTH(lookup_value, table_array As Range, _col_index_num As Integer, nth_value)
'Allows for finding the Nth item that matches the lookup value
Dim nRow As Long
Dim nVal As Integer
Dim bFound As Boolean
VLOOKUPNTH = "Not found"
With table_array
For nRow = 1 To .Rows.Count
If .Cells(nRow, 1).Value = lookup_value Then
nVal = nVal + 1
'Check to see if this is the nth match
If nVal = nth_value Then
VLOOKUPNTH = .Cells(nRow, col_index_num).Text
Exit Function
End If
End If
Next nRow
End With
End Function
On page 53: Looking at the definitions in the formula below I believe the underscore should be eliminated for the formula to work - I had to drop it.
Function VLOOKUPNTH(lookup_value, table_array As Range, _col_index_num As Integer, nth_value)
'Allows for finding the Nth item that matches the lookup value
Dim nRow As Long
Dim nVal As Integer
Dim bFound As Boolean
VLOOKUPNTH = "Not found"
With table_array
For nRow = 1 To .Rows.Count
If .Cells(nRow, 1).Value = lookup_value Then
nVal = nVal + 1
'Check to see if this is the nth match
If nVal = nth_value Then
VLOOKUPNTH = .Cells(nRow, col_index_num).Text
Exit Function
End If
End If
Next nRow
End With
End Function