Remove Duplicates From List of Lines.

serge

Well-known Member
Joined
Oct 8, 2008
Messages
1,408
Office Version
  1. 2007
Platform
  1. Windows
Hello everyone,

I have a list of numbers starting in row CG7:C23, I need a formula starting in cell CG27 that will return the numbers between 1 to 70 with no duplicate ! like it show in the green row 27.

Thank you.
2589.PNG
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi, I really need this formula to ease my table, can someone help me with it Please.
Thank you.
 
Upvote 0
Have you considered a VBA solution?
Book3
ABCDEFGH
1 Col 1 Col 2 Col 3 Col 4
26732477
36726093
473879584
590427595
696158872
78776651
898777388
989697386
1077788133
11
12615243342516069
13
Sheet1


VBA Code:
Sub MakeList()
    Dim WS As Worksheet
    Dim I As Long
    Dim S As String
    Dim SLO As Object
    Dim rng As Range, R As Range

    Set WS = ActiveSheet
    Set rng = WS.Range("A2:D10")

    Set SLO = CreateObject("System.Collections.SortedList")
    S = ","
    For Each R In rng
        If R.Value >= 1 And R.Value <= 70 And InStr(S, "," & CStr(R.Value) & ",") = 0 Then
            I = I + 1
            S = S & R.Value & ","
            SLO.Add R.Value, R.Value
        End If
    Next R

    If I > 0 Then
        With WS.Range("A2").Offset(rng.Rows.Count + 1)
            For I = 0 To SLO.Count - 1
                .Cells(1, I + 1).Value = SLO.GetByIndex(I)
            Next I
        End With
    End If
End Sub
 
Upvote 0
Here's a formula solution...

serge.xlsm
CGCHCICJCKCLCMCNCOCPCQCRCSCTCUCVCWCX
6362760
7
8834727
9
10506832
11
12774854
13
14335534
15
16318059
17
18913555
19
20676863
21
22724282
23
24
2518
26273132333435364247485054555960636768
Sheet1
Cell Formulas
RangeFormula
CG25CG25=SUM(IF(FREQUENCY(IF(CG6:CI22>=1,IF(CG6:CI22<=70,CG6:CI22)),IF(CG6:CI22>=1,IF(CG6:CI22<=70,CG6:CI22)))>0,1))
CG26:CX26CG26=IF(COLUMNS($CG26:CG26)<=$CG$25,SMALL(IF($CG$6:$CI$22>=1,IF($CG$6:$CI$22<=70,IF(ISNA(MATCH($CG$6:$CI$22,$CF26:CF26,0)),$CG$6:$CI$22))),1),"")
Press CTRL+SHIFT+ENTER to enter array formulas.


Hope this helps!
 
Upvote 0
Thank you so much to both of you, I prefer to use the formula because I don't really know how to use code but thank you for proposing it, I really appreciate your help, I really needed it.
 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,037
Members
449,205
Latest member
Eggy66

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