I have a sheet full of some raw data, about 20,000 rows and 50 columns. (Number of rows expected to increase, probably double if not triple)
I need a formula to look at this data and determine if a row exists for data in two specified columns. My current formula is as follows.
Function CheckExists(Table As Range, SearchCol1 As Integer, SearchVal1 As Variant, SearchCol2 As Integer, SearchVal2 As Variant)
Dim i As Long
Dim exists As Boolean
exists = False
For i = 1 To Table.Rows.Count
If Table.Cells(i, SearchCol1) = SearchVal1 Then
If Table.Cells(i, SearchCol2) = SearchVal2 Then
exists = True
Exit For
End If
End If
Next i
CheckExists = exists
End Function
I run this formula from another sheet, with about 5000 rows.
My problem is, this kills my pc, it takes ages to calculate the cells. I'm hoping someone can offer some suggestions on how to make this faster or even better, a built in formula that can do what I'm after.