+ Reply to Thread
Results 1 to 4 of 4

finding the last non-zero value and deleting cells to the right

  1. #1
    Registered User
    Join Date
    04-26-2006
    Posts
    4

    finding the last non-zero value and deleting cells to the right

    hello,

    i have a number of large data files filled with unnecessary 0 values. some of the 0s are important (if they occur before the final non-zero item), while others are unnecessary and interfere with analysis.

    the data is stored in time bins (each column is a bin)
    and each row is a unique trial

    what i want to do is starting at the far right, find the last non-zero value for each row and clear all of "0" values that appear to the right of that cell in the row. it seems like it should be quite simple to do in a macro, but i can't figure it out. help would be much appreciated. thanks guys!

  2. #2
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    It would help you if you could provide a small sample of your work and what you to have as a final product.

    Thanks
    Denis
    Denis

    Please always attach the sample workbook without sensitive information when asking for help

    To add a module
    Press Alt + F11 (this is the Visual Basic Environment)
    Insert Menu, select Module
    Past code there
    Close Visual Basic Environment (X)

  3. #3
    Registered User
    Join Date
    04-26-2006
    Posts
    4
    hi,

    ok, i've uploaded a fe2 trials. data are in a csv file, but i had to zip the file just so it was an acceptable format...

    there are 2 types of bins. the first start at column P and go to column AT. the second group starts at AW and goes to CT.

    i'd want to start looking for non-zero values from the rightmost boundary of each type, so from AT --> P. find the first non-zero value and trim off all the trailing 0s.

    and then then the same from CA --> AW. find first non-zero value and clear the value of all cells with "0" to the right.

    the end result would be look much the same, with blank cells in place of the trailing 0s.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363
    Hi

    The file contain data from A1:AT10 only. However, you might want to use the following tool to remove the zero. Go the menu Tools ---> Options In the view tab remove the check mark Zero Values. This will remove all the zeros in your worksheet.

    Hope it helps

+ 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