I am currently stuck on a function I am working with: I wish to create a function that does a VLOOKUP on concantened Strings, then returns a numero.
Without further ado, here is my intent:
Function CusVlookup(lookupval As String, columna1 As Range, columna2 As Range, indexcol As Long)
Dim x, y As Range
Dim result As Long
For Each x In columna1
For Each y In columna2
If x.Value & y.Value = lookupval Then
result = Cell(x.Row, indexcol).Value
End If
Next y
Next x
CusVlookup = result
End Function
So my question is: where am I wrong? Is it in the concatenation of values / comparison with a string?
Second question is: how can I work/test a Function in developpment with MsgBox & loops? Can´t find a way to do tests..
(To be totally honest, it is already a second option since I have been trying to d an INDEX-MATCH combination with Evaluate function, but after 24h of failure (even with the nemerous threads I found) I thought this might be easier, fitting my needs and actually easily re-usable.)
Thanks to whoever can help me!