need for some code to add in a counter??

walt1122

Active Member
Joined
Jun 6, 2002
Messages
318
Hello all, Have a need for some code to add in a counter?
Let me try to explain and maybe there is a better way to do it.

I have a tremendous amount of data, an average of 46,000 KB on each file in .RTF (Rich Text Format). I did find some code that helps me parse it into Excel by allowing me to set the maximum number of lines I can put on one workbook and then add a new workbook to continue the import filling into one workbook after another until all the data is imported. The way the original data is set up it is hard to work with, it isn't set up very well as you will see in the sample below. I have been able to use some simple formulas to extract the info on to one line so I can later do a sum-total for each person on the file. From the 60,000+ records on each worksheet I can get convert that into about 5,000 lines. However the problem, because the import stops at the predetermined counter number I quite often have a persons information on two workbooks. I would like to be able to pause the import at some point other than just the line counter alone and use the word "Northern Trust" or something so I don't pick up some participant information on the end of one file and conclude it on the top of another. I was thinking of a second counter in conjunction with the first so that the code does something like Count1 = "When row > 65,500 AND Count2 = "Northern Trust" > some count ( for example I did a countif and found 1,158 occurrences of "NORTHERN TRUST" on the file I have already imported. . I would eventually like to automate combining the workbooks together later and I could probably to try and fit all the data on one workbook. I'm thinking it is easier to do the sub totals now on 5,000 lines of data instead of trying to do it on 65,000 lines after I have combined them. Any help or direction on this effort would be greatly appreciated.
temp_5.txt
ABCDEFGHIJ
34\parNORTHERN TRUST
35\parBENEFIT PAYMENTSANNUAL STATEMENTOF PAYMENTS REPORT BYALPHA LASTNAMEDATE1/14/2005
36\parREPORT ID BPP425-ASP*HONEYWELL*PROGRAMID BPPB250R
37\parCLIENT 0018HONEYWELLPAGE19,705
38\parPLAN AB5FROM 1/01/2004 - 12/31/24
39\par
40\parPARTICIPANT NAMESSNPAYMT REF#
41\parHOME ADDRESSPART IDPAYMT DATEPAYMTTYPEW/H & DED
42\parPAYMENT/ADVICE ADDRESSRETIRE DATEFUNDING SOURCEAMOUNTTAXATIONAMOUNT
43\par______________________________________________________________________________________________________________________________________________________
44\parPublic, John Q.5/3/2004CHECK5146845
45\par123 any where123-45-6789BENEFIT999.83FEDERAL0NET AMOUNT789.37
46\parany town, any city zip123456789GROSS AMOUNT999.83GA STATE0
47\par10/1/2002BASMED210.46
48\parDIST CODE 7TOTAL210.46
49\par
50\parORDINC999.83TAXABLE999.83
51\parNONTAXABLE0
52\par______________________________________________________________________________________________________________________________________________________
53\parPublic, John Q.6/1/2004CHECK5691750
54\par123 any where123-45-6789BENEFIT999.83FEDERAL0NET AMOUNT789.37
55\parany town, any city zip123456789GROSS AMOUNT999.83GA STATE0
56\par10/1/2002BASMED210.46
57\parDIST CODE 7TOTAL210.46
58\par
59\parORDINC999.83TAXABLE999.83
60\parNONTAXABLE0
61\par______________________________________________________________________________________________________________________________________________________
62\parSmith, John7/1/2004CHECK6283632
63\par105 my street3456-78-9012BENEFIT999.83FEDERAL0NET AMOUNT789.37
64\parnew town NJ zip3456789012GROSS AMOUNT999.83GA STATE0
65\par10/1/2002BASMED210.46
66\parDIST CODE 7TOTAL210.46
67\par
68\parORDINC999.83TAXABLE999.83
69\parNONTAXABLE0
70\par______________________________________________________________________________________________________________________________________________________
71\parSmith, John8/2/2004CHECK6775662
72\par105 my street3456-78-9012BENEFIT999.83FEDERAL0NET AMOUNT789.37
73\parnew town NJ zip3456789012GROSS AMOUNT999.83GA STATE0
74\par10/1/2002BASMED210.46
75\parDIST CODE 7TOTAL210.46
76\par
77\parORDINC999.83TAXABLE999.83
78\parNONTAXABLE0
79\par______________________________________________________________________________________________________________________________________________________
temp_5
</span><span class="gensmall"></span></td></tr></table></td></tr><tr><td class="row1" width="150" align="left" valign="middle"><span class="nav">Back to top</span></td><td class="row1" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18"><tr>
 
I'm afraid what ever method; it has to be something our outside auditor's can do. I'm a functional illiterate in Excel but the are ten times worse. They would have to be the ones to load up the data and do the queries cause remember I can't touch the data. That is the purpose for the macros. If left to their own devices they will print out the report and circle the hundreds of names they need to check and then want me to address letters and envelopes and mail out and log and research and tabulate and, and. You get the idea.

Walt
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Norie, not to be a bigger pest than I already am.. but that code is not working for me. I try running it but it takes way, way too long. Best I have accomplished is to get to line 5,000 after, I bet, more than 30 minutes of time has elapsed. It would take too long this way.

Can you just answer this question.

Is there any way to combine an "IF statement", or use the "case", or loop or whatever so that

there could be some thing like this:

If Counter > 65000 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr

or
If Counter > 65000 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr
Else
If Counter >65001 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr
Else
If Counter > 65002 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr
Else
If Counter > 65003 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr
Else
If Counter > 65004 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr
Else
If Counter > 65005 And Left(ResultStr, 19) = "\par NORTHERN TRUST" Then
'Output One Line Of Text From Variable To File
Print #g, ResultStr

or case1. something = 65000
case2.something = "Northern Trust"
or LOOP UNTIL SOMETHING


I don't know what I'm talking about but I can't believe Excel doesn't have a way to do this.

I try it and I get it to loop once and do the 10,000KB or so but then it just does 1KB after another adding in a new Text.TXT file one after another. I know it is that Print #g, ResultStr thing but I just can't seem to get it to reset?? and start over????

thanks

Walt
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top