Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble combining 2 text files in one spreadsheet in excel 1

Status
Not open for further replies.

kanin247

Programmer
Apr 23, 2001
113
US
Same message as before, just forgot the Subject line.

To Whom It May Concern:
I'm trying to combine/read from two text files in excel. I have already imported one text file (listings.txt) which contains general information into excel. I want the other text file (failuretype.txt) which lists the detailed description of each failure types to be read into (i.e., added to) the spreadsheet containing listings.txt according to the specified failure type. So, ultimately, the two spreadsheets will be combined.

For clarity, the files look like the following:

listings.txt
Machine Name ID Voltage Type
Berkeley G120 150 Failure 3
Bamberg Q890 350 Failure 10
Newberry P076 250 Failure 75

failuretype.txt
Type Part Part Number
Failure 1 Plastic P23823
Failure 2 Glass G82391
Failure 3 Screw S72489
... ...
Failure 10 Fuse F32719
... ...
Failure 75 Wire W23932

final spreadsheet should look like
Machine Name ID Voltage Type Part Part Number
Berkeley G120 150 Failure 3 Screw S72489
Bamberg Q890 350 Failure 10 Fuse F32719
Newberry P076 250 Failure 75 Wire W23932

The Type field from the listings.txt file will be hidden so it will just be used as a reference since the failuretype.txt file already has the necessary heading.

So, if anyone could provide me with any assistance, I would greatly appreciate it. Thank you.

kanin
 
I assume that you would import the details into two separate sheets.

You wou need to write a macro to first import and format the data. This will include setting up blank columns for part number and part in the listings data.

Then write a macro to calculate the number of rows in the import data for loop. This includes both listings and failure type.

Using a loop, insert a vlookup function into each cell in the listings data to get your part and part number information.

Hope this approach is useful?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top