sparky2205
Well-known Member
- Joined
- Feb 6, 2013
- Messages
- 507
- Office Version
- 365
- 2016
- Platform
- Windows
Is there a way to return an absolute row number from a lookup given the relative row number within the lookup?
I have a spreadsheet with a lookup (MATCH) in a loop.
Because I am looking for repeating values, each time it loops it resets the starting position of the lookup to the last found value +1.
So, the number returned from the lookup might be 12, i.e. the match was found in position 12 of the lookup range.
But this might be row 54 of the spreadsheet.
Is there a way to turn that relative lookup reference (e.g. 12) into an absolute workbook reference (e.g. 54)?
This is my lookup:
This is a snippet of the code just to give an example of what I'm doing.
Currently this returns the same row number every time as the relative reference within the lookup always returns the same value to FoundRow1, even though the lvalue value changes.
Hopefully there is enough detail here to explain what I'm looking for. Please ask if more is required.
I have a spreadsheet with a lookup (MATCH) in a loop.
Because I am looking for repeating values, each time it loops it resets the starting position of the lookup to the last found value +1.
So, the number returned from the lookup might be 12, i.e. the match was found in position 12 of the lookup range.
But this might be row 54 of the spreadsheet.
Is there a way to turn that relative lookup reference (e.g. 12) into an absolute workbook reference (e.g. 54)?
This is my lookup:
VBA Code:
With Application
' Find the next occurrence of the personnel using the starting range (srange) and the last found occurrence (FoundRow + lvalue)
FoundRow1 = .IfError(.Match("*-*", Range(("A" & lvalue - 9) & ":A" & lastrow), 0), 0) + 3
Rows(FoundRow1).Hidden = False
End With
Currently this returns the same row number every time as the relative reference within the lookup always returns the same value to FoundRow1, even though the lvalue value changes.
Hopefully there is enough detail here to explain what I'm looking for. Please ask if more is required.