Macro for matching contents in external file

Lourry

Registered User.
Local time
Today, 04:31
Joined
May 19, 2004
Messages
41
Hello All,

I have two text files (lets say A.txt and B.txt) and in each of these text files, there are two columns. One is "description" the other is "name". Furthermore, I have a huge spreadsheet with many columns and rows. In this spreadsheet, in columns B and D are the "description", which is exactly the same as the ones in the two text files. I would like to write a macro that searches these two text files for the matching "description" and put the corresponding "name" in columns A and C. (example: macro starts matchng the first row of column B and it finds a match in A.txt and puts the corresponding "name" in column A of the spreadsheet)

In column E, I would like the macro to put the word A or B depending on which file the match was found.

Is this do-able??? Please advise....

Many thanks!
-Lory
 
I have imported the two files into my existing spreadsheet in Excel. They are in 4 columns, the first two are "description" and "name" from the first text file and the other two columns are the "description" and "name" from the second text file. They are in columns F, G, H, I respectively.

Is there a way I can use perhaps, VLOOKUP, and match each row of column B and D to F and H then put the corresponding contents of G or I in A or C??

Thanks in advance!
 
Help! Please??!

This is my "english" code:

FOR range B2:B3883
FOR range F1:F3883
IF a match found THEN
put contents in column G into column A
put contents in column H into column E
END IF
Next row
Next row

Could someone please help me translate this into macro-language??

THanks for all the help!
 
Are you talkiing about something like

Column1_______Column2
John................Mike
Jack................Bill
Don................Arthur
James..............John
Mike................Don
Charles............Alan
Don................ Anthony
Warwick...........Bill
Don................Ted
Alan...............Alice

Are you tring to get a situation where you would be able to get other data from from Colum1 in to other data on Colum2 and where the names matched.

Note also that I have Don 3 times in Column1 and only oce in Column2. Do you have that situation.

Mike
 
Yes

I dont have any repetitions in Column A.

I get data file every morning and I want to IMPORT data from data files into MASTER FILE.

Master File columns:

Temp:
Density:
Color:
Volume:

Data File columns:

Temp:
Color:
Density:
Volume
Max Density:


1. There are no repititions of headings in any file
2. Data file has varying headings, I only want to import the required columns.

Can something like this be done?
 

Users who are viewing this thread

Back
Top Bottom