I'm trying to create an Excel UDF that acts like the native MATCH function, but with multiple criteria. While debugging with a simple comparison between numbers, the objListItem == objListCriteria line isnt't catching the match and is just skipped over "when it should" catch.
I've looked at the locals window and both variables are the same data type and the same value (i = 5, objListItem = 12, objListCriteria = 12), but it doesn't register as a match.
Can anyone point out what I'm doing wrong? Thanks!
I've looked at the locals window and both variables are the same data type and the same value (i = 5, objListItem = 12, objListCriteria = 12), but it doesn't register as a match.
Can anyone point out what I'm doing wrong? Thanks!
C#:
// loop through main index array
i = 0; j = 0;
int? z = null; // set NULLABLE value for matching row
// i is the data row to search in
for (i = 0; i < arrIndex.GetLength(0); i++)
{
// j is to column(s) of data rows
for (j = 0; j < dblList.Count - 1; j++)
{
object objListItem = arrIndex[i, j];
Type T1 = objListItem.GetType();
object objListCriteria = objList[j];
Type T2 = objListCriteria.GetType();
// if row IS a match for this criteria
if (objListItem == objListCriteria)
{
z = i;
continue;
}
// if row is NOT a match
else if (objListItem != objListCriteria)
//if (arrIndex[i, j] != objList[j])
{
// if row is not a match, reset return value to NULL
z = null;
goto OuterLoop; // then skip to the next row
}
}
OuterLoop:
continue;
}