+ Reply to Thread
Results 1 to 8 of 8

Scan D column until numbers no longer increase, keep last high value, delete rest, repeat

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Post Scan D column until numbers no longer increase, keep last high value, delete rest, repeat

    Hello everyone,

    The title basically describes it all. Please refer to the attached picture for the more detailed version. Would anybody know how to get this done?


    Sample.JPG

    Thanks for all the help!

  2. #2
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    H.. Thats an interesting requirement and in actual fact.. you image does show well what you want..

    Having said that.. can you attach a Workbook with your data so we can test any solution that we may have.. (Workbooks are always preferred over images)..

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    This is a brute force method, there might be a more efficient way using vlookup or .Find or something, I'm just not familiar with searching for something like "< Value - 0.1".

    And to echo apo, an example workbook with before and after's would help in testing the code.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Post Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    walruseggman , thank you for your hard work on the code. It did seem to work at first, but then there was a mismatch type error. You and apo are correct and I do appologize for not providing a workbook. So here it is for you to fool around with. I really do appriciate the help and hard work!
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    The error is because some of your cells contain "<null>" (like around row 164), and obviously it's nonsensical to try to evaluate if a number is less than a string of text. I've accounted for that in the code, but would need to be more general if there can be other non-numbers.

    I ended up with 108 rows of data after running this on your test file.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Post Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    Great work on the code walruseggman! It does exactly what I explained for it to do. Unfortunately, there are some exceptions in the data that are causing the code to grab the wrong line and delete the correct one. Some of the rows that remain after running the code have zeros in the B, C, and G columns which isn't the data needed. These columns need to show maximum values when the D column has its maximum and resets.

    It also seems like the D column number will decrease by more than 0.1 then increase before finally decreasing steadily again. So there is sometimes a "bump" in the data resulting in the return of more rows than needed. This isn't a huge issue as I can go through these manually and delete them. The issue is deleting data that is needed. Would it be possible to add some kind of buffer zone before deleting values? So find the correct row and also keep the row before and after while deleting the rest? Then I could go through manually to pick out the correct rows since the amount of data is more manageable. It's not ideal, but that way I would be sure all data is accounted for and correct. Unless of course you know of a better suggestion.

    I really appreciate your help with everything so far walruseggman!

  7. #7
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    find the correct row and also keep the row before and after while deleting the rest?
    Try this:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-31-2014
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Scan D column until numbers no longer increase, keep last high value, delete rest, rep

    Thanks walruseggman! That will do nicely. I appreciate the help.

+ 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. Delete Blank Rows and Auto Sum the rest values in the column..
    By kittu55 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-29-2013, 11:35 PM
  2. Macro to filter certain values in a column and delete the rest
    By willy91785 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2011, 12:23 PM
  3. Macro : To find word and Select rest after this cell and delete rest
    By Zortabello in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2010, 08:06 AM
  4. Extract Number in Column + Delete the rest
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2009, 03:38 AM
  5. Scan column for numbers and report ones not found
    By Badvgood in forum Excel General
    Replies: 1
    Last Post: 04-10-2007, 06:45 AM

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