Unique values in Table (most efficient way)

Freedox

New Member
Joined
Mar 11, 2015
Messages
39
Hi,

I'm using a formula below to determine if the formula is unique. If the ID is unique, then write 1, if repeat then 0. All values are in a table with 100k+ lines and the formula seems to extremely resource intense...

Does anyone know if there is a more efficient way of calculating unique values?

Code:
=IF(COUNTIF($X$2:X2,[@[WEB_ID]])>1,0,COUNTIF($X$2:X2,[@[WEB_ID]]))
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi, is column X the Web_ID column?

This would be a little faster:

=0+(COUNTIF($X$2:X2,[@[WEB_ID]])=1)

And if you can sort your data on column X then this would be very fast.

=1-(X2=X1)
 
Upvote 0
Thanks, FormR, it looks like it's faster, nowhere near I wish it was... but slight improvement :) Cheers!
 
Upvote 0
=MATCH(x2,x:x,0)-ROW()

Where ever there is a zero result is the first occurrence. Sort column where you place this formula (largest to smallest) to place all zeros at the top and those will be your unique values.
 
Upvote 0
Sorry, left something out. Enter the formula =MATCH(x1,x:x,0)-ROW() in each row of containing data in a blank column
 
Upvote 0
Hi, are you not able to sort on that column?

I'am, but info comes in from SQL server and every time I'm updating it I thought it would mess it up all data... However, ran a few tests and it looks like it's working! And you are right it's million times faster!

Thanks for that!!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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
Back
Top