Replace MATCH with more efficient formula

fboehlandt

Active Member
Joined
Sep 9, 2008
Messages
334
Hi everyone

I would like to check if a specific name in a column of consecutive names has appeared already. The below formula does exactly what I am looking for:

=IF(ISERROR(MATCH(T2,$T$1:T1,0)),"","Existing Member")

when copied to the last cell adjacent to the column containing the names. There are roughly 75000 names to check so performance becomes an issue. Is there any more efficient way to do this besides using MATCH?

Thanks
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
=ISNUMBER(MATCH(T2,$T$1:T1,0))+0

1 = a hit, i.e. an existing member, 0 = a miss, i.e. ok.

This should be a tad faster.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,166
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Can you sort the data on the name column?
 

fboehlandt

Active Member
Joined
Sep 9, 2008
Messages
334
Thanks, both great answers. I managed to sort the data in a custom function, assign flag and re-order according to initial ranking

Code:
Function FindShared(MyRange As Range)


Dim n As Long
n = MyRange.Count
ReDim MyArr(1 To n, 1 To 3) As Variant


For i = 1 To n
    MyArr(i, 1) = MyRange(i)
    MyArr(i, 2) = i
    MyArr(i, 3) = MyArr(i, 1) & Application.Text(MyArr(i, 2), "000000")
Next i


'sort by membername
QuickSortArray MyArr, , , 3


MyArr(1, 3) = ""
For i = 2 To n
    If MyArr(i, 1) = MyArr(i - 1, 1) Then
        MyArr(i, 3) = "SharedMember"
    Else
        MyArr(i, 3) = ""
    End If
Next
    
'sort per rank (initial)
QuickSortArray MyArr, , , 2


FindShared = Application.Index(MyArr, 0, 3)


End Function

I used Nigel Heffernan's quick sort for the array
 

Watch MrExcel Video

Forum statistics

Threads
1,123,502
Messages
5,602,037
Members
414,496
Latest member
Nishnoshnish

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top