hi all,

I am comparing 2 data:

Data 1 has 26 colums that have the information of comapanies and detail of informations.
Data 2 has 18 coulums that have the information of peoples.

Form the name of people (data 2) I want to make the new data which have all the informations.

for example with A people (NguoiA).I hope i have the informations below:

Nguoi A:
congty sp nhom20 nhom21 nhom22 nhom25 nhom26
cong ty B A 1,610.00 1,610.00 920,000.00 149,937.00 16.3
cong ty B B 400 400 212,000.00 -2,000.00 -0.94
cong ty B C 432 864 245,376.00 -2,851.00 -1.16
cong ty B D 14,800.00 14,800.00 6,304,800.00 -164,280.00 -2.61
Total 17,242 17,674 7,682,176 -19,194 12

cong ty A E 1,560.00 3,120.00 463,320.00 -26,208.00 -5.66
cong ty A F 3,000.00 3 321,000.00 33,000.00 10.28
Total 4,560 3,123 784,320 6,792 5

bang keo G 200 10 45,000.00 25,400.00 56.44
total 200 10 45,000 25,400 56

Thank you very much for helping.

If you are looking for code, then I won't give you. If you are asking for idea about how to deal with it, then here it is.

First, you need to read the data in from both files. Create another variable for saving new data. Then iterate through both data and matched the name with the company. Save the matched data in the variable you defined earlier. Once you have gone through, save the collected data in a new file.

The challenge will be parsing the data. Both files have different format, so you need to be careful when you parse data. The people data can be parsed line-by-line; whereas, the company data seems to be column-by-column. That's all.