Search code examples
excelvbarangematchworksheet

How to use the match Function with two criteria in VBA


I am trying to use the „MATCH“ function in order to get the Row (named RICRow) number of a name which is contained in the “RIC“ column (A). Because there are always two names in the RIC column (e.g.”Tom”) it is necessary to take the column(L) “RIC_FID” into consideration which contains a unique value corresponding to the names (e.g. 295). The VBA code below keeps yielding the error msg: type mismatch

RICRow = Application.WorksheetFunction.Match(RIC & RIC_FID, protokoll.Range("A1:A500") & protokoll.Range("L1:L500"), 0)

Solution

  • this one solved the issue:

    RICRow = protokoll.Evaluate("match(""" & RIC & "" & RIC_FID & """, A:A&L:L, 0)")