Problem with filtering unique value of 800,000 rows using Advanced Filter

Cakz Primz

Board Regular
Joined
Dec 4, 2016
Messages
102
Office Version
  1. 365
Platform
  1. Windows
Dear MrExcel,

I need to extract, filtering the unique PO Number in sheet A, column X and then copy only the visible rows into sheet B, column D.
The number of rows is reaching 800,000 rows.
I am using Microsoft Office 365.

I've tried for to filtering using Advanced Filter, fail. It gave me, "not responding". Even though I am only opening this workbook only.
Can anyone would like to share a macro to solve this problem?

Thanks in advanced, really appreciate for your kind assistance and helping hand.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try using dictionary object instead of filter.
This will give you unique data.
Note:
1. you need to change sheet & range references to suit
2. it's case sensitive. If you want it to be case insensitive then uncomment this line: 'd.CompareMode = vbTextCompare
VBA Code:
Sub Cakz_Primz()

Dim i As Long
Dim va, x
Dim d As Object

With Sheets("Sheet1")
    va = .Range("A2", .Cells(.Rows.Count, "A").End(xlUp))
End With

Set d = CreateObject("scripting.dictionary")
'd.CompareMode = vbTextCompare

For i = 1 To UBound(va, 1)
    d(va(i, 1)) = 1
Next

ReDim va(1 To d.Count, 1 To 1)

i = 0
For Each x In d.keys
   i = i + 1
   va(i, 1) = x
Next
'put the result
Sheets("Sheet2").Range("A2").Resize(UBound(va, 1), 1) = va
End Sub

Example:
Book1
A
1NAME
2Rodrigo
3Sullivan
4Giovanni
5Cayson
6Blaise
7Patrick
8Damian
9Todd
10Kaleb
11Cayson
12Blaise
13Patrick
14Damian
Sheet1

Result:
Book1
A
1
2Rodrigo
3Sullivan
4Giovanni
5Cayson
6Blaise
7Patrick
8Damian
9Todd
10Kaleb
Sheet2
 
Upvote 0
Solution
Dear Akuini,

I've tried your magical code, and it worked !!!
Very fast !!!
Problem solved.

Thanks so much for saving my life.

Dear MrExcel,
Thank you
 
Upvote 0
You're welcome, glad to help & thanks for the feedback.:)
 
Upvote 0

Forum statistics

Threads
1,214,810
Messages
6,121,690
Members
449,048
Latest member
81jamesacct

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