+ Reply to Thread
Results 1 to 24 of 24

Extract specific text from Text file

  1. #1
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Question Extract specific text from Text file

    Dear all,

    I have one text file. i need extract specific text to Excel file. please find text file and sample excel file attachments. kindly solve with code.

    Thanking you all,
    Best regards.
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-20-2016 at 06:43 AM.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Extract specific text from Text file

    Hi.

    This should do it. You'll just need to change the file path to the correct location.

    (Also Column 2 the Concrete strength is 25 MPa not 30 MPa as shown in your example solution!)

    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by Crooza View Post
    Hi.

    This should do it. You'll just need to change the file path to the correct location.

    (Also Column 2 the Concrete strength is 25 MPa not 30 MPa as shown in your example solution!)
    Dear sir,
    Thank you for your kind reply and point out sample file mistake. is this possible make a code by choosing file location dialog box pop (Instead of "C:\temp\")?

    Thanking you sir,
    Best regards.
    Last edited by pvsvprasad; 08-20-2016 at 06:45 AM.

  4. #4
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Extract specific text from Text file

    This version should open a dialogue box for you to select the file

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Extract specific text from Text file

    You could try:

    Please Login or Register  to view this content.
    Alf

  6. #6
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by Alf View Post
    You could try:

    Please Login or Register  to view this content.
    Alf
    Dear sir,

    thank you for your code.
    after using your code entire text file is pasted to new excel sheet. kindly check the code.

    which location i have to paste above quoted code?


    thanking you sir,

    Best regards.

  7. #7
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Extract specific text from Text file

    You asked for

    a code by choosing file location dialog box pop (Instead of "C:\temp\")?
    and that is what you got. If this was not what you wanted you got a post from crooza that hopefully is what you wish for and not what you asked for.

    Alf

  8. #8
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by Crooza View Post
    This version should open a dialogue box for you to select the file
    Dear sir,
    sorry for confusion, i am wrongly assumed as #4 and #5 codes is produced by one person.i apologies for this wrong assumption.

    after using your #4 code entire text file is pasted to new excel sheet. kindly check the code.

    thanking you sir,

    Best regards.

  9. #9
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Extract specific text from Text file

    Yes it extracts the text file as a workbook in order to get the data you require. What exactly isn't working?

  10. #10
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Extract specific text from Text file

    This will close the text file afterwards if that is what the issue is

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Question Re: Extract specific text from Text file

    Quote Originally Posted by Crooza View Post
    This will close the text file afterwards if that is what the issue is
    Dear sir, thank you for preparing.
    issue is Your code is producing error.kindly find the sample files of text and Excel files. please correct the code.

    Thank you,
    Best regards.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-21-2016 at 01:43 PM.

  12. #12
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Please find InputText file. please solve this bug.
    Attached Files Attached Files

  13. #13
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Extract specific text from Text file

    OK A couple of things

    1. You've changed the format of your file. You've moved your input data around into different columns. For this example I put your data BACK into your original columns AB and AC
    2. You're now asking for different data to be searched for. In your original file you had data that matched your search file so there was no need to check if there wasn't a match, now you're seeking to find only a subset which means I need to code around that for the instances where there is no match
    3. Your latest example has 'new' column data with three columns of returned data - what s the 2000 and the 230? are you seeking to collect that data too.

    The attached file represents your original file (and its format) but I've added your latest input data list. It extracts only what it can find and skips the rest. It presumably will work multiple times if your search data is in different text files. Just run it again and select the next text file to search in.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by Crooza View Post
    OK A couple of things

    1. You've changed the format of your file. You've moved your input data around into different columns. For this example I put your data BACK into your original columns AB and AC
    Yes sir, i am apologies for sending wrong moved column data.your prepared code for columns, i.e AD and AE columns are correct.
    yes sir, i need columns for 2000 and 230 also required. but for those columns i have used one old code.so please combine your latest code with my old code with minor corrections.

    in my old code having some bugs. there is developing some repeating rows and not maintained output rows as ascending order with respect to "Z' Column(i.e, 1,2,3,4,5 etc)
    my old code for X to AC column as below:

    Please Login or Register  to view this content.
    kindly make suitable correction to form exact code or make a New code by your way of style by selecting .anl text file format.please find of Exact format of sample Output excel file.

    thank you for your kind help.
    ,
    with best regards.
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-22-2016 at 02:37 AM.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Extract specific text from Text file

    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Question Re: Extract specific text from Text file

    Quote Originally Posted by jindon View Post
    Dear sir, thank you for kind reply. you code is nice. minor bugs are arrived. please fix these bugs.
    1)AB column is starting from Y column. i.e Y to AE columns
    2)Please make out put data as a Ascending order with basis of of Z column. kindly find the sample excel file.
    3)And some of Rows are printed duplicates with respect to Z column members.

    please find exact form of Output excel file.

    kindly make these corrections, rest of all your code is good.

    Thanking you sir,
    Best regards.
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-22-2016 at 03:31 AM.

  17. #17
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    please find Exact format of Excel format file and Raw data text file.

    Thanking you,
    Best regards.
    Attached Files Attached Files

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Extract specific text from Text file

    You must learn the meaning of "BUGS".
    I've just worked on your first post. I haven't even looked at the rest of the posts.

    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by jindon View Post
    You must learn the meaning of "BUGS".
    I've just worked on your first post. I haven't even looked at the rest of the posts.
    Dear sir,
    i have expressed extreme apologies for using of that word. sorry for poor technical knowledge.i will edit my posts.
    now your code is perfect.thank you for preparing.please make small correction. i.e out put should be producing as ascending order with respect to Z column order.example based upon Z should produced from lowest value to highest value(1,2,3,4, etc).

    please find sample output excel file.

    thanking you,
    Best regards.
    Attached Files Attached Files
    Last edited by pvsvprasad; 08-22-2016 at 03:33 AM.

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Extract specific text from Text file

    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Extract specific text from Text file

    Deleted wrong thread.......................
    Last edited by jindon; 08-22-2016 at 03:47 AM.

  22. #22
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by jindon View Post
    change
    to
    Please Login or Register  to view this content.
    Dear sir,
    your code is really marvelous. its working as a charm.(your provided sample file link #21 is not working. showing download error as "Invalid Attachment specified. If you followed a valid link")

    Thank you very much for solving my problem sir.

    Best regards.

  23. #23
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Extract specific text from Text file

    I can't open a ZIP file but it looks like JINDON has this well and truly covered now. You should ensure you add to his reputation as he/she has done a lot o work to sort this out for you.

  24. #24
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Re: Extract specific text from Text file

    Quote Originally Posted by Crooza View Post
    I can't open a ZIP file but it looks like JINDON has this well and truly covered now. You should ensure you add to his reputation as he/she has done a lot o work to sort this out for you.
    Yes sir, sure.
    you also doing well. thank you for your effort.

    Best regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. if text is in specific format then file other cells with specfic text
    By Louisa Venter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-23-2016, 02:45 PM
  2. [SOLVED] Export specific range to text file and import the text file if needed
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2015, 07:38 AM
  3. Replies: 1
    Last Post: 02-23-2013, 08:36 AM
  4. Replies: 5
    Last Post: 05-03-2011, 09:35 AM
  5. Replies: 0
    Last Post: 10-29-2008, 06:21 PM
  6. Extract specific text from cell to save file
    By SOS in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-25-2008, 03:06 PM
  7. How to extract text from-to a specific position in a text
    By Sven in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-13-2005, 04:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1