Solved

import data in excel  from text file

Posted on 2014-02-18
7
493 Views
Last Modified: 2014-02-25
Hi Experts,

I have 100000 lines in text file which are in file 'current' format.
request to achieve the format as in  'final' excel fromat

the VB script should be able to match the column heading and have data in the corresponding rows.


It would be ideal: If the column heading does not exist script should be able to create a heading too.
Current.txt
final.xlsx
0
Comment
Question by:macentrap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 30

Expert Comment

by:gowflow
ID: 39870350
1. Can we assume that the header in the xlsx will be there when we import the data ? as you may notice it is not always that all fields in each group that are represented, so it would be better to have at least the header to start with. Can we assume that ?

2. Can you post a .txt that have a bit more records ? no need for 100000 but 2 only is really the low end.

gowlfow
0
 
LVL 30

Accepted Solution

by:
gowflow earned 500 total points
ID: 39870552
I have assumed that the header is there in the final output.

1) Please make sure macros are activated
2) I created a backup of your sheet1 so you can compare the results.
3) I created Sheet2 where I pasted on the header. Position yourself in Sheet2 actually for this macro to run oyu only need to be positioned in the sheet where you need to data to be extracted to,
4) Go to Developper Tab and press on Macro and select ImportText and check the results.

For sure it would be better to have more data so we can check if all is ok.

Regards
gowflow
final-V01.xlsm
0
 
LVL 7

Author Comment

by:macentrap
ID: 39871519
Thank you gowflow, i will try soon and update
have attached current file with more data set
Current.txt
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Expert Comment

by:gowflow
ID: 39872587
I tried the attached file and for me its fine, but will leave it to the Expert who knows better his own job to decide.
gowflow
0
 
LVL 7

Author Comment

by:macentrap
ID: 39885357
Thank you gowflow it works.
 Apologies for late reply.
0
 
LVL 7

Author Closing Comment

by:macentrap
ID: 39885358
great script
0
 
LVL 30

Expert Comment

by:gowflow
ID: 39885384
Glad I could help
gowflow
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question