JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
I have a two column VLOOKUP table, which currently I'm passing to a dictionary object to replace output with mapped data.
I'm trying to see if I can reduce the amount of code by using VLOOKUP within EVALUATE, so far have tried:
F5:F8 contains either valid keys (A, B, C) from the VLOOKUP table or empty cells
If F5 contains A, then relative for all non empty cells in F6:F8, G5:G8 contains the mapped item to A only
If F5 contains A and F6:F8 contains blank and non valid keys, then G5:G8, if not blank, contains mapped item to A only
If F5 is blank then #N/A returns for relative in G6:G8 (The VLOOKUP table doesn't allow for a blank key)
It seems to only return the vlookup value for F5, if it's not an error for all cells in G6:G8 where F6:F8 is not blank, regardless of what F6:F8 has
Can VLOOKUP be used in EVALUATE like this, if so how?
TIA,
Jack
I have a two column VLOOKUP table, which currently I'm passing to a dictionary object to replace output with mapped data.
I'm trying to see if I can reduce the amount of code by using VLOOKUP within EVALUATE, so far have tried:
Code:
Sub test()
'F5:F8
With Cells(5, 6).Resize(4)
.Offset(,1).Value = Evaluate(Replace("IF((@<>""""),VLOOKUP(@,Error_Values,2,0),"""")", "@", .Address))
End With
End Sub
F5:F8 contains either valid keys (A, B, C) from the VLOOKUP table or empty cells
If F5 contains A, then relative for all non empty cells in F6:F8, G5:G8 contains the mapped item to A only
If F5 contains A and F6:F8 contains blank and non valid keys, then G5:G8, if not blank, contains mapped item to A only
If F5 is blank then #N/A returns for relative in G6:G8 (The VLOOKUP table doesn't allow for a blank key)
It seems to only return the vlookup value for F5, if it's not an error for all cells in G6:G8 where F6:F8 is not blank, regardless of what F6:F8 has
Can VLOOKUP be used in EVALUATE like this, if so how?
TIA,
Jack
Last edited: