Below is a function that works with a formula to return the Nth occurance. It is not returning the correct data. Just appears like the function will not fail.
in sheet Champs
L1 formula is =Nth_Occurrence(N_TH,Champs!$C$3,1,0,4)
L2 formula is =Nth_Occurrence(N_TH,Champs!$C$3,2,0,4)
L3 formula is =Nth_Occurrence(N_TH,Champs!$C$3,3,0,4)
L4 formula is =Nth_Occurrence(N_TH,Champs!$C$3,4,0,4)
L5 formula is =Nth_Occurrence(N_TH,Champs!$C$3,5,0,4)
L6 formula is =Nth_Occurrence(N_TH,Champs!$C$3,6,0,4)
L7 formula is =Nth_Occurrence(N_TH,Champs!$C$3,7,0,4)
The first formula is broken down like this
N_TH is a named range of sheet1 $B$2:$B$20
Champs!$C$3 is what I want to find the number of occurances of
C3 = "CH"
1 = occurance #
0 = row.offset
4 = column.offset
Example -
In sheet1 $B$2:$B$20 there are 3 occurences of "CH"
B7 = Lima
B8 = Denver
B9 = Oakland
Here are the results I get
L1 Lima
L2 Denver
L3 Oakland
L4 Lima
L5 Denver
L6 Oakland
L7 Lima
Cells L4-L7 should fail and return an error but it just starts over
in sheet Champs
L1 formula is =Nth_Occurrence(N_TH,Champs!$C$3,1,0,4)
L2 formula is =Nth_Occurrence(N_TH,Champs!$C$3,2,0,4)
L3 formula is =Nth_Occurrence(N_TH,Champs!$C$3,3,0,4)
L4 formula is =Nth_Occurrence(N_TH,Champs!$C$3,4,0,4)
L5 formula is =Nth_Occurrence(N_TH,Champs!$C$3,5,0,4)
L6 formula is =Nth_Occurrence(N_TH,Champs!$C$3,6,0,4)
L7 formula is =Nth_Occurrence(N_TH,Champs!$C$3,7,0,4)
The first formula is broken down like this
N_TH is a named range of sheet1 $B$2:$B$20
Champs!$C$3 is what I want to find the number of occurances of
C3 = "CH"
1 = occurance #
0 = row.offset
4 = column.offset
Example -
In sheet1 $B$2:$B$20 there are 3 occurences of "CH"
B7 = Lima
B8 = Denver
B9 = Oakland
Here are the results I get
L1 Lima
L2 Denver
L3 Oakland
L4 Lima
L5 Denver
L6 Oakland
L7 Lima
Cells L4-L7 should fail and return an error but it just starts over
Code:
Function Nth_Occurrence(range_look As Range, find_it As String, occurrence As Long, offset_row As Long, offset_col As Long)
Dim lCount As Long
Dim rFound As Range
Set rFound = range_look.Cells(1, 1)
For lCount = 1 To occurrence
Set rFound = range_look.Find(find_it, rFound, xlValues, xlWhole)
Next lCount
Nth_Occurrence = rFound.Offset(offset_row, offset_col)
End Function