+ Reply to Thread
Results 1 to 10 of 10

Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    24

    Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    I have this massive table with every day from 1989 - 2013 listed in row 1. There are cash flows listed under each date. Right now the file size is a bit unmanageable and I would like to condense the table to hold only the necessary values to produce the XIRR (cash flow attached to the correct date).

    The biggest issue I'm having right now is writing a macro that will keep the cash flows lined up with their original dates. It is also important to keep all of the cash flows on their original row since they match up with specific purchases. I'm not sure if two or more cash flow usages occured on the same date across row or down column, but if this did happen, it may create errors.

    I've attached the table
    Dates and Cash Flows Table.xlsm

    Any help or suggestions would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    The attached has not data.
    I suggest to include a desired result when you re-attach it.

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    The workbook I just opened from you has no data in it.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Registered User
    Join Date
    06-06-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    Sorry,
    Here's about a ninth of the data; the file was too large before

    Attachment 241486

    >>AB33: I'm not sure what this needs to look like to at its smallest while retaining all the necessary information.

  5. #5
    Registered User
    Join Date
    06-06-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    I did have one idea as to how to format the data. It might make lookups and calculations more difficult.

    Idea 1:Dates and Cash Flows Table.xlsm

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    You have two sheets. The data sheet has all 0

  7. #7
    Registered User
    Join Date
    06-06-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    They should be there. Each row has between 5-15 cash flow entries and with 8500 columns it's easy to miss seeing the data.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    Yes, I can see it, you have 8677 columns. What is the criteria for deleting a row? Is it one column need to be 0 in order for a row to be deleted, or entire row has to be 0?

  9. #9
    Registered User
    Join Date
    06-06-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    Sorry, this is hard to explain when I'm not really sure what I need.

    I want cells that contain zeros to be deleted. The biggest concern I have right now is creating some method to keep each one of those cash values aligned with the respective date above.

    The final product may end up looking like Idea #1, or something I have not thought of yet.

    It might be easiest to remove all date columns that do not contain any values other than 0, but with the full data table with 270 rows of cash flow data with about 2700 (270*apx 10 cash flow entries/row) unique cash flow entries, the number of columns would only be cut by about 2/3. Cutting the data by 2/3 is still a pretty good result.

  10. #10
    Registered User
    Join Date
    06-06-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition

    On second thought, I'm going to remove this thread from the forem for now and start it up again once I have a better idea of what needs to get done. Hell, I might even figure it out myself by then Sorry for wasting your time with my ambiguity AB33, thanks for trying to help.

+ 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