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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

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