+ Reply to Thread
Results 1 to 17 of 17

Delete Numbers Of one Col to another

  1. #1
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Delete Numbers Of one Col to another

    Hello All

    i have 7,00,000 numbers in col A and in Col c i have about 85000 numbers i want to delete col C numbers from A!

    i have below code its not working.

    attached is sample (small) set of data.

    Please Login or Register  to view this content.

    Adeel
    Attached Files Attached Files

  2. #2
    Forum Expert Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,448

    Re: Delete Numbers Of one Col to another

    One way perhaps...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    Hi sintek , thnx for your reply and code

    i run it to my original file,i can understand its huge set of data


    almost after min it shows "Not Responding" but still i wait almost 10min code still running...



    Adeel
    Attached Images Attached Images

  4. #4
    Forum Expert Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,448

    Re: Delete Numbers Of one Col to another

    This takes about 30 sec...85000 entries in Col A and 75000 entries in Col C
    Please Login or Register  to view this content.
    Last edited by Sintek; 09-06-2021 at 10:43 AM.

  5. #5
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    i tried to upload file its 7Mb forum isn't allowing for such heavy file

    if you don't mind to run below code than col A and C data will appear for your reference

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello ! Try this !


    According to your attachment a VBA demonstration for starters which should be fast enough :

    PHP Code: 
    Sub Demo1()
            
    Dim S&
            
    Application.ScreenUpdating False
        With 
    [A2].CurrentRegion
              
    .Columns(2).Formula "=--ISNUMBER(MATCH(A2,C$2:C$" & [C1].End(xlDown).Row ",0))"
               
    Application.Sum(.Columns(2))
            If 
    S Then
                
    .Resize(, 2).Sort .Columns(2), 1
                
    .Rows(.Rows.Count ":" & .Rows.Count).Clear
            End 
    If
                .
    Columns(2).Clear
        End With
            Application
    .ScreenUpdating True
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  7. #7
    Forum Expert Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,448

    Re: Delete Numbers Of one Col to another

    Check this option...?
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb The fastest way …


    According to post #5 :

    • The 'ccc' VBA procedure corrected in order to well create the initial values :

    PHP Code: 
    Sub InitValues()
      Const 
    700000
        Dim V
    C#(), N&, R&
            
    Evaluate("ROW(1:" ")+6665858580")
            
    ReDim C(1 To L 80)
            For 
    1 To L Step 8:  1:  C(R0) = V(N1):  Next
            Application
    .ScreenUpdating False
            
    [A1].Resize(L).Value2 V
            
    [C1].Resize(UBound(C)).Value2 C
            Application
    .ScreenUpdating True
    End Sub 
    • Considering both columns are ascending sorted the fastest way to remove matching numbers : (v2)

    PHP Code: 
    Sub Demo2()
            
    Dim VWXL&, R&, N&
        
    With [A1].CurrentRegion
            V 
    = .Value2
            W 
    = [C1].CurrentRegion.Value2
            ReDim X
    (1 To UBound(V), 0)
            
    1
        
    For 1 To UBound(V)
            While 
    W(L1) < V(R1) And UBound(W):  1:  Wend
            
    If V(R1) <> W(L1Then N 1X(N0) = V(R1)
        
    Next
           
    .Value2 X
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 09-06-2021 at 12:27 PM.

  9. #9
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    @Marc L thnx for code its run for 5 sec but do nothing i posted data reference in my last reply post#5

    @sintek thnx, but sorry its took about 10 min to run then i have stop it because its showing not responding again, i really appreciate your all efforts

  10. #10
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    ohh thnx @Marc L this is brilliant, may you post while when i was writing my above reply ,too fast this is, lot of thnx for this

  11. #11
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    Hi Marc L, if you don't mind what is the advantage of use value2 instead of only value although code is working with both! really appreciate your reply on this, please

  12. #12
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Delete Numbers Of one Col to another


    Thanks for the rep' !

    First see the VBA help for both Value & Value2 properties.
    As Value2 could be somewhat a bit faster as there is less interpretation from Excel side in particular when writting to cells …

  13. #13
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Re: Delete Numbers Of one Col to another


    Adeel,

    check if you have the last version of my Demo2 VBA procedure within post #8 'cause I've made an optimization to avoid a 'glitch' …

  14. #14
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    Many thnx for your help and reply!! you adopted outclass idea to make it faster

  15. #15
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    i tested the code and verify results, it run without any error or glitch, thnx sir
    Attached Images Attached Images

  16. #16
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Delete Numbers Of one Col to another


    It was some logic glitch so be sure for future use to have the last version with the While codeline within the For loop …

  17. #17
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: Delete Numbers Of one Col to another

    i tested it throughly now, first I put 150000 nums in col c then i put 250000 then i put all 700000 nums in col C, all deleted without any error! still i will be careful for one or two days

    i also cross verify it with vlookup in Col b then below formulas

    =+SUMPRODUCT(--(A:A<>""))
    =+SUMPRODUCT(--(C:C<>""))

    sum of both should be 700000 and it is, thnx
    Adeel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Insert row numbers into column A, reflect correct row numbers when I add or delete rows
    By jcambell in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-31-2015, 02:18 PM
  2. [SOLVED] Delete text, split numbers to two cells and store as numbers
    By Steve_123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2014, 09:51 AM
  3. Replies: 4
    Last Post: 10-05-2012, 08:23 AM
  4. Replies: 3
    Last Post: 10-05-2012, 06:38 AM
  5. [SOLVED] Delete Other Numbers Except Cell Numbers
    By it_electronics2000 in forum Excel General
    Replies: 43
    Last Post: 04-10-2012, 06:11 AM
  6. [SOLVED] delete numbers and replace with numbers from adjacent column
    By troysie in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-13-2010, 05:31 AM
  7. IF not numbers delete
    By djranks in forum Excel General
    Replies: 1
    Last Post: 12-17-2005, 01:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1