+ Reply to Thread
Results 1 to 6 of 6

Compare cells to delete lines?

  1. #1
    Registered User
    Join Date
    09-18-2006
    Posts
    30

    Compare cells to delete lines?

    I have a problem and am wondering if someone knows a fairly simple solution. I create a spreadsheet each month which contains about 20 tabs, each of which has a varying number of lines of the following data. I would like to eliminate rows which only have 2 occurances of the same part number (in red), keeping only those lines which have 3 or more occurances of the same part number. Any help would be appreciated.


    8/31/06 K 34 9998 2D8540 SEAL 1
    8/31/06 K 34 9998 2D8540 SEAL 2
    8/31/06 K 34 9998 2D8540 SEAL 1
    8/31/06 K 34 9998 2D8540 SEAL 1
    8/31/06 K 34 9998 2H2665 O-RING 1
    8/31/06 K 34 9998 2H2665 O-RING 2
    8/31/06 K 1 9998 2S-8439 SEAL 1
    8/31/06 K 34 9998 2S-8439 O RING 1
    8/31/06 K 34 9998 2X464 SWITCH 3
    8/31/06 K 34 9998 2X464 SWITCH 2

  2. #2
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    Is that 3 or more per sheet, or across the whole workbook?
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.

  3. #3
    Registered User
    Join Date
    09-18-2006
    Posts
    30
    Looking at each sheet individually. Sorry to confuse the issue. Each sheet is for a different store. I am just trying to establish when a store has ordered the same part 3 or more times in a single month.

  4. #4
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    No worries, it would be slightly more complicated if you were looking at all the sheets together. If there are no gaps in each list, the part number is in column D and the data starts on row 1 (as opposed to there being headings there and the data begins at row 2), this will do the job:

    Please Login or Register  to view this content.
    Change "D1" if necessary.


    HTH
    Col

  5. #5
    Registered User
    Join Date
    09-18-2006
    Posts
    30
    Worked great Col. Thanks for helping me impress my boss.

    One more favor, only if you have time. Could you kind of explain each step in the macro. I am trying to learn more about macros, and would like to understand what this one is doing

    Thanks

  6. #6
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    Please Login or Register  to view this content.
    The best way to find out what the code is doing is to step through it a line at a time using F8, looking at the spreadsheet to see what changes are hapening at each point. Also, while the execution is paused, you can see the value of a lot of things by hovering the pointer over them - or you can highlight something and right-click at and select Add Watch - then you can see it's value all the time. Experiment! Change things to see what they do. Just don't forget to save anything vital first!


    C

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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