Create Unique list based on 2 columns values

JonasTiger

New Member
Joined
Jan 28, 2022
Messages
28
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi
I would aprecciate help in formula to create unique list based on 2 columns values:
Tryng with "=SORT(UNIQUE(A3:A26;FALSE))"
Thanks
Col ACol BCol DCol E
EXISTING LISTRESULT WANTED
Value 1Value 2Value 1Value 2
123ABC123ABC
123ABC123DEF
123DEF123GHI
123GHI123JKL
123GHI456ABC
123JKL456DEF
123JKL456GHI
456ABC456JKL
456DEF456MNO
456GHI789ABC
456GHI789DEF
456JKL789GHI
456MNO789JKL
456MNO789MNO
456MNO789PQR
789ABC
789DEF
789DEF
789GHI
789JKL
789JKL
789MNO
789PQR
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Change the A3:A26 to A3:B26
 
Upvote 0
Hi
In fact, it works in consecutive columns. I've tried that already.
I'm afraid I wasn't clear enough. My mistake, sorry.
Cols in existing list are not consecutive. For example, Value 1 is in Col A, Value 2 is in Col C. In this option, formula doesn't work:
I've tried "=SORT(UNIQUE(A3:A26;C3:C26;FALSE))" or "=SORT(UNIQUE((A3:A26)*(C3:C26);FALSE))" - no success
 
Upvote 0
Hi
Try
VBA Code:
Sub test()
    Dim a As Variant
    Dim i As Long
    With Sheets("sheet1")
    a = .Range(.Cells(5, 1), .Cells(5, 1).End(xlDown)).Resize(, 3)
    With CreateObject("scripting.dictionary")
        For i = 1 To UBound(a)
            If Not .exists(a(i, 1) & a(i, 3)) Then .Add (a(i, 1) & a(i, 3)), Array(a(i, 1), a(i, 3))
        Next
        a = Application.Index(.items, 0, 0)
         End With
       .Cells(5, 5).Resize(UBound(a), 2) = a
    End With
End Sub
 
Upvote 0
Ok,how about
Excel Formula:
=SORT(UNIQUE(index(A3:C26;SEQUENCE(rows(A3:A26));{1\3});FALSE))
 
Upvote 0
Solution
Hi
Thank you for your suggestion, I will try.
But, any options in formulae?
@Fluff
your message entered at same time. I will go try your formula
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Hi
Try
VBA Code:
Sub test()
    Dim a As Variant
    Dim i As Long
    With Sheets("sheet1")
    a = .Range(.Cells(5, 1), .Cells(5, 1).End(xlDown)).Resize(, 3)
    With CreateObject("scripting.dictionary")
        For i = 1 To UBound(a)
            If Not .exists(a(i, 1) & a(i, 3)) Then .Add (a(i, 1) & a(i, 3)), Array(a(i, 1), a(i, 3))
        Next
        a = Application.Index(.items, 0, 0)
         End With
       .Cells(5, 5).Resize(UBound(a), 2) = a
    End With
End Sub
Thank you for your contribution, I will try later and compare performance with @Fluff formula
 
Upvote 0
The formula should be faster, especially on large data sets.
 
Upvote 0

Forum statistics

Threads
1,215,636
Messages
6,125,952
Members
449,276
Latest member
surendra75

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