+ Reply to Thread
Results 1 to 13 of 13

modify .csv file to get into format for import to another program.

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    modify .csv file to get into format for import to another program.

    hello,

    for transparency, this is a follow-up to a wonderful bit of code that AlphaFrog provided (reference below link).

    http://www.excelforum.com/excel-prog...ml#post3860133

    the code has been working really well right up until December. what happened in December is that mutual funds started putting out capital gain distributions. once this happened, the code got confused and started doing unexpected things. I'm hopeful that AlphaFrog or someone similarly familiar with what he's done can take the code and make some slight modifications to it that will make it work again.

    I've included a few things for context.

    (a) the entirety of the code I've been using is below. the relevant portion of the code starts with the comment "handle the dual transaction....."
    (b) a raw .csv file example of the sheet I've been using the code on is attached.
    dpm_schwab_one_-_19_Transactions_20141231-103500.CSV
    (c) a spreadsheet named "excelforum7.xlsx" has been attached to show the new transactions that are causing problems. I've included a "before" tab and an "after" tab to show what the code needs to do. it's similar to what the existing code performs for dividends; but as mentioned above the addition of capital gain distributions complicates things a bit.
    excelforum7.xlsx
    (d) also, to perhaps make it slightly easier, the code can simply delete one of the transaction pairs. I show what I'm talking about in the file named "excelforum7.xlsx". once we delete one of the transaction pairs, we're combining two transactions into one, so the final column needs to change from a negative number to a positive number.

    please let me know if there's any additional clarity I can provide for more understanding. I think this makes sense; but of course, I've been staring at it for hours ;>)

    thank you in advance for the assistance.

    Please Login or Register  to view this content.
    Last edited by wingfield65; 12-31-2014 at 03:38 PM. Reason: corrected attachment on item (b)

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

    Re: modify .csv file to get into format for import to another program.

    Your before sheet shows you want to delete the positive numbers and keep the negative numbers, but your after sheet only shows positive numbers.

    Attachment 367696 does not work
    Last edited by davesexcel; 12-31-2014 at 02:48 PM.

  3. #3
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: modify .csv file to get into format for import to another program.

    davesexcel,

    Your before sheet shows you want to delete the positive numbers and keep the negative numbers, but your after sheet only shows positive numbers.
    my sheet before is what it looks like before. it's not showing what I want to do.

    the sheet after shows only positive numbers; because that's what I want it to look like after the code does it's thing. I mention this in (d) of my post.

    rows 16, 17, & 18 on the after sheet are originally in rows 19,20, and 21 in the before sheet after having been modifying in two respects.
    (i) the transaction codes in column b have been replaced, and (ii) the amounts in column h have been changed from negative to positive. the original rows 16,17, and 18 are deleted and are not shown in the after sheet.

    Attachment 367696 does not work
    I've fixed this. thank you for letting me know.

    hopefully, I've added some clarity; but let me know if not.

    thank you

    david
    Last edited by wingfield65; 12-31-2014 at 03:45 PM.

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

    Re: modify .csv file to get into format for import to another program.

    See if this works for you,
    See attached.

    It will probably need some tweeking, but it is a good start
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davesexcel; 12-31-2014 at 06:04 PM.

  5. #5
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: modify .csv file to get into format for import to another program.

    davesexcel,

    thank you. you're right - it's a very good start. I think this is close. I stepped through it using f8 to see what it does and I noticed a couple things.

    (a) it looks like when it loops through, it assumes the first transaction is the one that will get deleted and it copies the description in column b to the description of the paired transaction. this is not always the case. if you look at rows 36 and 38 of the "excelforum7" file you can see that for INTC, the transactions are in the opposite order. the impact of this is that the code doesn't modify the column b action but leaves it as whatever it was. any thoughts on how to get around this?

    (b) also, it looks like the code is running through indiscriminately. in other words, at some point it deletes the not needed paired transactions (haven't figured out how you did that yet since the code I think is doing this starts with a Columns("F:F") - but that was pretty neat ...). anyway, it's deleting things it doesn't need to delete. as an example, in rows 35 and 37. this particular transaction pair neither needs to be modified or have a not needed transaction deleted. this is my fault for not properly framing the problem. sorry about that.

    (c) one more thing I noticed, when I tried to run this on the "raw" .csv file, it didn't seem to work. to test this, I ran the original code I shared in my post with a hard stop at the line that AlphFrog did for me (since you're basically replacing that). then I tried to run your code. if you want to not address this one until we get the above flanged up that's fine. perhaps I'm just missing something so I'll continue to take a look at it.

    thank you for all the help. I'm amazed that the assistance this forum provides. I've used it a few times in the past with similar success.

    thoughts?

    david

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

    Re: modify .csv file to get into format for import to another program.

    Is this how you wanted
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: modify .csv file to get into format for import to another program.

    davesexcel,

    have you had a chance to give this any consideration.

    jindon - yours doesn't seem to work.

    thank you,

    david

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

    Re: modify .csv file to get into format for import to another program.

    What's wrong with jindon 's code?

  9. #9
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: modify .csv file to get into format for import to another program.

    davesexcel,

    so jindon's code didn't work because of a mistake I made. the code that I've asked for is in addition to some that I already had (posted in my original email). as such, to get either yours or jindon's code to run, I need to run the 1st part of my code with a break at the point that the new code comes into play. I had not done this.

    I've now run Jindon's code. it seems to be handling the capital gain reinvestments (both short and long term); but not the dividends. it's also more complicated than I have the capability to edit myself. your code had called out each type of transaction, so I was hopeful that when more transactions popped up, I could simply modify the code myself to add any new ones.

    thoughts

    david

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

    Re: modify .csv file to get into format for import to another program.

    No thoughts,
    I don't want to get too involved with this, as I have spent quite a bit of time on it already.

  11. #11
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: modify .csv file to get into format for import to another program.

    anyone want to take a stab at this? davesexcel made a good start and shared that it would likely need some tweaking; but he's not wanting to get further involved. jindon also made a good start; but has perhaps not seen any of the follow-up posts. since there's been some depth to this thread, should I repost it with the entirety of the issue as well as what the proposed code still doesn't do; rather than expect folks to wander through what's there already?

    I don't want to get crossways on the forum rules; and I have not cross post this to any other forums. I do hope to get this solved. I welcome any feedback.

    david

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

    Re: modify .csv file to get into format for import to another program.

    If you are talking about the file other than your posted one, just forget it.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    06-20-2014
    Location
    Houston, TX
    MS-Off Ver
    Office 365
    Posts
    47

    Re: modify .csv file to get into format for import to another program.

    jindon,

    I'm not referring to anything that I haven't posted. my original post has two files, the one you refer to and a 2nd one. they are both clearly linked in the first post.

    suggesting that I "forget it" on a help forum seems a bit inappropriate. if I've asked for something that's too complicated for folks to figure out, then I'm open to someone simply politely telling me that it's too difficult to solve. if I've been unclear, then I'm open to someone simply telling me I've been unclear. I very much understand that it's sometimes difficult to convey what the problem is and what is being asked to solve. I've not violated any forum rules that I'm aware of. I'm simply posting on a help forum for help.

    davesexcel - I certainly respect your comment that you're not interested in spending more time on this; and I appreciate your directness despite your comment that the code might need tweaking.

    jindon - I'm not sure where you're coming from. your comment seems rude to me. that said, I do very much appreciate the code you provided. I readily admitted that I made a mistake in trying to run it the first time.

    for transparency, I'm going to look at other forums and will consider cross posting. If I do cross post; I will certainly honor forum rules and provide a link.

    I appreciate and thank you for the help that's been provided.

+ 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. [SOLVED] clean up downloaded .csv file for import into program (final one)
    By wingfield65 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-23-2014, 10:27 PM
  2. [SOLVED] clean up downloaded .csv file for import into program
    By wingfield65 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-08-2014, 09:53 PM
  3. Text File import program not functioning
    By Oliver H in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2010, 04:13 PM
  4. Modify file import macro to skip previously imported files.
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2009, 04:37 PM
  5. How do I keep Excel temp. format on import from another program?
    By Bill in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-11-2006, 11:00 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