Home > Software engineering >  Read TXT file data compared with the excel data, and find out the highest frequency of a group
Read TXT file data compared with the excel data, and find out the highest frequency of a group

Time:09-26

TXT file there are tens of thousands of array, want to one by one, with thousands of data in excel, and find out the coincidence rate is highest in the first 10 sets of data, ask ace to help!
TXT file:
1, 2, 3, 4, 5
1,2,3,4,6
1,2,3,4,7
.

Excel file:
Two, four, five
3,2,6
.
Want to read every piece of data from a TXT file with excel all the data, choose the same probability of the top 10,
Read 1, 2, 3, 4, 5 and excel in the two, four, five,2,6 | 3 |... Find out the three Numbers on all the probability of the top 10 array

Thank you very much!

CodePudding user response:

I don't know, I also is asking

CodePudding user response:

1, put the excel data archived in the dictionary, because the basic is the same,
2, and then use 2 heavy cycle to solve your problem: the first loop reads the data in TXT file; The second loop for each set of data in each judgment (and see whether there is in the dictionary) and... You know,

CodePudding user response:

refer to the second floor Topc008 response:
1, put the excel data archived in the dictionary, because the basic is the same,
2, and then use 2 heavy cycle to solve your problem: the first loop reads the data in TXT file; The second loop for each set of data in each judgment (and see whether there is in the dictionary) and... You know

The problem of the building Lord, "dictionary" I'm afraid I can't!
For example, TXT files: 1, 2, 3, 4, 5 should conform to the excel file: two, four, five
A dictionary can express?
TXT file: 1,2,3,4,6 should conform to the excel file: 3,2,6
This dictionary can express?

Of course, if I apprehend the meaning of the original poster is wrong, that when I said nothing,

CodePudding user response:

If I have no intention of the original poster to understand correctly,
An element that can only be an element of comparison, count,
This should be used "triple loop to achieve a goal,"

CodePudding user response:

I haven't put the meaning is clear, 1, 2, 3, 4, 5 and,2,5 1 and 2,3,5 and 4-trichlorobenzene 1 and 2 and 4 more equal all think?

CodePudding user response:

If I do, will do this:

Take excel file as external database, import to an Access database table, the table with a list of records than success,

TXT text to the Line Input way read Line by Line, Line by Line using InStr function per column check if the database column values in the text, if there is a column is not successful, into the next database rows, if all the success of the current Line 3, the count column 1, and conclude the bank processing,

CodePudding user response:

If it is I, first will excel file save as. CSV file,

CodePudding user response:

Wasn't made clear the building Lord, is in Excel file data in a column or in three columns, the data in the text file is with fellow commas, or comma in English,
Do not have a problem, can be in Excel to create a table, record the same data in the data, the data, for example, rows of Excel, the lines of a text file, etc.,
If you need to just the two of your files to me, I help you, sent to QQ, 2653043392
  •  Tags:  
  • VBA
  • Related