+ Reply to Thread
Results 1 to 14 of 14

Excel to find in Notepad and pull data lines

  1. #1
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Thumbs up Excel to find in Notepad and pull data lines

    Hi All,

    I have a Notepad file which has N number (very large) of data. I also have a workbook which has just a few data as of the Notepad data. There may be possibilities ...either if the available ID number in the Excel Workbook is more than one time in the Notepad data or not available at all, so I need to pull all those lines (records) completely from Notepad to the workbook's a sheet (for knowing the repetition of ID in the notepad).

    Can anyone plz help me out with this urgent problem. I wanna run codes for this from MS Excel to Notepad, and just think that applying loops with count & find tricks can work in a faster way (...but don't know how to write codes for this situation).

    P.S. - Below are the attached sample files.

    Thanks in advance!
    Last edited by SunOffice; 11-07-2011 at 05:03 PM.
    Excelforum is Completely Awesome! True learning with Live Examples & Best Techniques!!

  2. #2
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Re: Excel to find in Notepad and pull data lines

    I googled it, but got a little idea to start the code as per my requirements:

    http://groups.google.com/group/micro...b83e0509bfaa00

  3. #3
    Forum Guru
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel to find in Notepad and pull data lines

    hi, SunOffice, I hope I understood right what you are looking for (from my second attempt). Run code "test"
    Attached Files Attached Files
    Last edited by watersev; 11-05-2011 at 07:24 PM. Reason: I think I understood the idea behind :)

  4. #4
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Question Re: Excel to find in Notepad and pull data lines

    Thank you so much for quick & great help!!

    ...and one more thing I require is that If a list of a few ID numbers are available on the worksheet then how can I come to know about each ID number's repetition (frequency) count in the available large data of Notepad file?

    Please see below attached file. I have just added a new column for the above situation or you can apply your ways.

    P;S. I need to paste all the found records(lines) from Notepad to another worksheet, so that there is no need to open the notepad again and verify manually.
    Attached Files Attached Files
    Last edited by SunOffice; 11-06-2011 at 07:19 AM.

  5. #5
    Forum Guru
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel to find in Notepad and pull data lines

    please check attachment
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Question Re: Excel to find in Notepad and pull data lines

    WOW...!!

    P;S. I need to paste all the found records(lines) from Notepad to another worksheet, so that there is no need to open the notepad again and verify manually.

    ...actually when I was working with you codes for my project; I just came to know these essential requirement. ...hope you/anyone can look into this situation, so tht I can successfully closed this thread from my end.


    ...Your programing tricks open a new channel for my vision ...thanks again for knowledge sharing.

    Please see the attached...
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel to find in Notepad and pull data lines

    please check attachment, run code "test"
    Last edited by watersev; 11-06-2011 at 04:37 PM.

  8. #8
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Re: Excel to find in Notepad and pull data lines

    Mr. watersev,

    Thank you sooo much!! It's working flawlessly
    Please Login or Register  to view this content.
    P.S. I'd be glad again if you could provide me link(s) to learn more abt the used trick & terminology?

    Thank you to this amazing forum for sharing knowledge!!

  9. #9
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Question Re: Excel to find in Notepad and pull data lines

    Thank you for listening to me again!

    Here is the updated attached, a sample text file. All the requirements are the same as said above in the posts or let me know if anything else is required.

    I tried with below, did a bit modifications, but could not get success - not getting the complete found data lines, line by lines.

    Please Login or Register  to view this content.
    Last edited by SunOffice; 11-30-2011 at 06:29 AM. Reason: Excel file is uploaded!

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,647

    Re: Excel to find in Notepad and pull data lines

    Please Login or Register  to view this content.
    Last edited by snb; 11-30-2011 at 06:35 AM.



  11. #11
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Re: Excel to find in Notepad and pull data lines

    Thank you snb for knowledge sharing!

    ...There are more than a million data available in the notepad/text file(s). and I have an excel sheet with a few records around 500, which my team has to manually find/ search in the notepad one by one. If one record is found single/ multiple times then need to copy that whole text line and paste in another sheet as well for data verification & collation purpose.

  12. #12
    Forum Guru
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel to find in Notepad and pull data lines

    try this option (I did not delete your comments):
    Please Login or Register  to view this content.
    Last edited by watersev; 11-30-2011 at 07:11 AM. Reason: updated file with the new code

  13. #13
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,647

    Re: Excel to find in Notepad and pull data lines

    So:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.


    1. the fastest search method in VBA I am familiar with is Instr.
    2. so I put all the existing ID's in column2 into 1 textstring (c01), each ID separated by a pipeline |
    3. I open the 'notepad' file, split all the rows and filter only those lines that contain a colon (only lines with a colon contain an ID in your notepad example): the result is a 1 dimensional array sn
    4. Now we check each line from the notepad file (= each element in the array sn) to the string that contains all existing ID's., using Instr.
    - To get the ID from each array-item we split each array-item by the tabdelimiter and take the first item from the splitting result. The first item is item 0.
    - we look whether the string c01 contains that item; if not
    * mark that item replacing it's value by "~~", so we can filter all "~~" items afterwards
    or (method snb_2)
    * filter the array sn by the not found ID, removing all items from sn that contain the not-found ID
    - method 1: remove from array sn all items that contain "~~")
    5. write the resulting array sn into sheet2
    Last edited by snb; 11-30-2011 at 08:08 AM.

  14. #14
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2010 & 2007
    Posts
    210

    Re: Excel to find in Notepad and pull data lines

    Thank you watersev!

    Yeah it is working fine here; let me try this on the main/ original text file at my work.
    ...and will let you know if anything goes wrong now.

    ...btw for below: Since there are many columns (15-20) with a particular order of data in the notepad, then what should I write instead of 4? or just go with this 4

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.35545 seconds
  • Memory Usage 9,275KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (7)bbcode_code
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (14)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (11)postbit_attachment
  • (14)postbit_legacy
  • (14)postbit_onlinestatus
  • (14)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php
  • ./includes/functions_notice.php 

Hooks Called (48):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1