+ Reply to Thread
Results 1 to 14 of 14

Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Excel 2003
    Raw data is given in Table 1 which consists of some zero row entries.

    RAW Data (Table 1)

    Time Price Volume Type
    8:58:19 2.77 4,000 Buy Up

    9:00:00 2.76 10,000 Sell Down


    9:00:02 2.76 15,000 Sell Down
    9:01:11 2.75 7,800 Sell Down


    There is a need to move the non-zero row entries to occupy the zero row entries. Deletion of zero row entries is not allowed.
    The final table looks like the following:


    PROCESSED Data (Table 2)

    Time Price Volume Type
    8:58:19 2.77 4,000 Buy Up
    9:00:00 2.76 10,000 Sell Down
    9:00:02 2.76 15,000 Sell Down
    9:01:11 2.75 7,800 Sell Down


    Attached worksheet template for reference.

    Help is appreciated.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Try this,
    Please Login or Register  to view this content.
    Rows are not deleted, just the blank cells.

  3. #3
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Thanks, but the blank rows cannot be deleted.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Try this........

    Please run the following code on sheet Test. The code is stored on module2. See if this is what you want.

    Please Login or Register  to view this content.
    Please see the attached sheet.
    Attached Files Attached Files
    Last edited by sktneer; 11-25-2013 at 03:04 AM.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Thanks, it works.

    But what if the Table starts at Column "H" Row "6" instead of the current Column "A" Row "1"?

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    If your table headers in row 6 i.e. table starts from H6, use the following code......

    Please Login or Register  to view this content.
    Last edited by sktneer; 11-25-2013 at 09:02 AM.

  7. #7
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Thanks, the code works fine but the processing takes about 1 minute to run the attached data sample.

    Is there any way to make the processing faster?
    Attached Files Attached Files

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Its because your requirement is unique as you don't want to delete the blank rows. I don't know any faster method. But instead of running the code at once, better you debug the code by pressing F8 to see each step involved in the process. Because after shifting the non blank cells data to the the blank cells up, the code has to recheck the data again from the beginning, therefore so many steps are involved.

  9. #9
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Thank you for your kind explanation. I understand better now. By the way, I will mark this thread as solved.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Quote Originally Posted by chancw View Post
    Thanks, the code works fine but the processing takes about 1 minute to run the attached data sample.

    Is there any way to make the processing faster?
    try the attached
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Jindon,

    This is an interesting idea!

    You try to get around the limitation by transferring the contents one by one to a table in another worksheet.

    I'm just thinking if I can extend your idea by transferring the contents to a table WITHIN the same worksheet.

    Do see the attached excel worksheet.
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Change to
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    jindon,

    Thanks, it works much faster now!

    But the color of the volume text values in original table(Table 1 Column C) did not get copied over to the new table (Table 2 Column I)

  14. #14
    Registered User
    Join Date
    12-01-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Move Non-Zero row entries up to occupy Zero row entries. Rows deletion not allowed

    Jindon,

    I encountered a new issue recently. When the raw data are available as follows:

    Time Price Volume Type
    10:10:05 $3.91 93,000 Sell Down
    10:10:05 $3.91 2,000 Buy Up
    10:10:05 $3.90 1,000 Sell Down

    the processed data becomes:
    Time Price Volume Type
    10:10:05 $3.91 94,000 Sell Down
    10:10:05 $3.91 2,000 Buy Up

    which is not supposed to. It seems that sometimes the algorithm disregards the price when the "Time" and "Type" are the same. Is it possible to correct this issue?

    Regards

+ 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. Replies: 1
    Last Post: 02-01-2013, 03:38 PM
  2. [SOLVED] Read entries-locate entries and print entries
    By akotronis in forum Excel General
    Replies: 4
    Last Post: 05-01-2012, 03:05 PM
  3. Deletion of dupe entries
    By dnyankardore in forum Excel General
    Replies: 1
    Last Post: 04-15-2011, 01:16 PM
  4. Deletion of dupe entries
    By dnyankardore in forum Excel General
    Replies: 1
    Last Post: 04-15-2011, 01:13 PM
  5. Removing repeat entries in a long column of data entries
    By kaizhong1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2010, 01:31 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