+ Reply to Thread
Results 1 to 8 of 8

Clean a database using a list

  1. #1
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Post Clean a database using a list

    Hello,
    I'm trying to simplify a database I got, of the follow form. Consider that each line is the descrition of an electoral funding bank transfer. Each candidate can have dozens.
    election code; data; hour; contract; Canditate ; transfer ; value ; financer
    133; ............................................John ; 77987 ; 800$ ; Big company
    133; ............................................John ; 79619 ; 1900$ ; Fat company
    133; ............................................Mark ; 87681 ; 300$ ; Little company
    (i put these unuseful variables before, as it is in the real file)

    I have 130.000 lines like that because the database is about candidates. But Mark has not been elected.
    I have an other database, with 550 names: the elected ones.

    Is there an automatic process, or VBA thing (i am so bad at VBA....) to clean the huge list ? I would like to delete all the lines where CANDIDATE is a name that does not appear in the other list. Do you see what i mean ?

    Thank you so much for your help,

    best

  2. #2
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Clean a database using a list

    Hi Ayadin,

    The attached workbook has code in it that removes the names from the Candidates sheet that are not in the Elected sheet, which I think is was you are describing. You can use this as an example and hopefully it gives you some guidance.

    Thanks,

    Dan
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Re: Clean a database using a list

    Hello,
    thank you for your file. indeed, i see how it works. Now, is there a way to write the code so that i dont need to change names in all the lines of the code ?

    Range("A1") = "name 1"
    Range("A2") = "name 2"
    Range("A3") = "name 3"

    The other option was to use something like this:
    =NB.SI(Feuil2!A:A;C2)
    It should put 1 if the name is present in Feuille (page) 2 and 0 if it is not. But that formula does not work actually I think I have a syntax problem.


    thanks
    Last edited by Ayadin; 06-10-2016 at 07:43 AM.

  4. #4
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Clean a database using a list

    Hi Ayadin,

    The only code you really need is the macro called "CleanCandidates". It could be modified to fit your specific situation. The ones that list all then names were just in there to reset the sheets for the example.

    I posted the pertinent code below with some comments on what would need to be modified for your specific case. It is set up to delete the entire row where a candidate name is not elected.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Clean a database using a list

    Alternative.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 06-10-2016 at 10:58 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Re: Clean a database using a list

    thanks ! great ! i did it !

    Now i have an other question... My file is like this now:
    elected1 - 900$ received - big company
    elected 1 - 750$ etc
    elected 1
    elected 2 - 670$ - little company
    eletected 3

    There are 513 différent "elected"

    I have an other file, of 513 lines, i have additional data on these guys:
    - which fraction of the party they are in
    - which alliance they have
    - the number of trials and condamnation they endure (yes...i'm working on a corrupted country and these numbers tend to infinity...)
    - their patrimony
    etc
    the form is:
    ELETECTED 1 - v 1......vn

    elected1 - 900$ received - big company ++++++ ELETECTED 1 - v 1......vn
    elected 1 - 1800$ received - big company2 +++ ELETECTED 1 - v 1......vn
    elected 2 - 670$ - little company ++++++++++ ELETECTED 2 - v 1......vn



    I'm soryr i dont have a clearer way to express what i'm trying to do. DO you think there is a way to do it ? thank you very much. I'll probably have to do this kind of manipulation often because i often get new data file with additional variables.


    THANK YOU ! and good weekend !

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Clean a database using a list

    You will have to explain a bit more of what it is you are trying to achieve because right now it's not making much sense to me.
    Thanks for the rep.

  8. #8
    Registered User
    Join Date
    06-09-2016
    Location
    Paris
    MS-Off Ver
    2011
    Posts
    52

    Re: Clean a database using a list

    Hi,
    I found a way to do it: i'm adding values thanks to Search V
    in page 1 i have infos like
    name - v1 v 2
    and in paeg 2 i have:
    name v3 v4
    because variables come from different sources. So with searchV i manage to important the needed variables to my page1, which is where i have all the data.

    do you maybe know an other way to do it ?

+ 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] Convert list including char(10) to a clean list
    By scottiex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-04-2014, 12:02 AM
  2. Clean up Database exported as Excel
    By emmer in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 05-15-2013, 09:32 AM
  3. Help me clean up my task list
    By eljusticiero67 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2012, 12:45 AM
  4. [SOLVED] VBA Code to optimize and clean data- clean out numerical/ or symbol
    By tracylsr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2012, 04:21 PM
  5. [SOLVED] Transforming messy database into clean database
    By SteveC in forum Excel General
    Replies: 4
    Last Post: 01-24-2006, 07:35 PM
  6. clean duplicates in list
    By frank101 in forum Excel General
    Replies: 1
    Last Post: 06-15-2005, 05:05 PM
  7. [SOLVED] Address Database Clean-up
    By Wynn in forum Excel General
    Replies: 3
    Last Post: 06-15-2005, 03:05 PM

Tags for this Thread

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