Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Finding cells in an array with criteria

Hello guys

I'm having a problem with one project and I could use a little bit of help.

I want to open a txt file on a worksheet and then to search for two words inside the worksheet and when it finds one of the two strings to do something


can anyone help ??

Last edited by leonakos : November 29th 10 at 04:16 PM
  #2   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by leonakos View Post
I want to open a txt file on a worksheet and then to search for two words inside the worksheet and when it finds one of the two strings to do something

can anyone help ??
You can write Visual Basic code to open and read a text file, etc... but I'm assuming you want a simple answer:

(this example pertains to Excel 2007 -- there may be differences for other versions of Excel)

Open a blank worksheet.
Click on the "Data" tab (near the top of the window).
Click on "From Text"
A Security Notice window might pop up, if so, click "OK"
A window opens asking for "File Name" -- navigate through the folders until you find the text file you want to read.
Click once on the "Filename" then click "Import"
The Text Import Wizard window opens to guide you through the import of text data into your worksheet.
Assuming your file is delimited by some character (commas, tabs, semicolons, etc.), select the radio button for "Delimited" then click "Next".
Check the boxes which correspond to the type of delimiters contained within the file. As you check these boxes, you will see a sample of the data divided into fields to show you how the text is going to be broken up upon import.
Click "Next" with the sample divisions look right (you have selected the appropriate delimiters for that file).
The next screen lets you click on each column to then specify if it is General, Text, a Date, or a field you do not want to import.
Click "Finish"
The next window asks where to put the data. Enter "=$A$1" (without the quote marks) to have the text start in the upper left corner of the worksheet.
Click "OK"
Now you should be looking at the worksheet with the text data you just imported.

To answer the second part of your question (how to find two particular words inside the text), I'll need more information:

Are these two searches where you will find two separate words, or are the words together (with a space between) and you want a single search for the pair?

Are you searching for a word that might be imbedded within the string which makes up one field? For example, you might be looking for "cat" in the following table of text:

animalsatthezoo
horsedogmonkey
zebracatsnake
birdfish

"cat" could be identified to be contained within the 3rd element of the table.

Please provide a sample of text, which part of the text you are looking for, and what you want to do when you find the word you are looking for.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the Max, Min values based on certain criteria for an array swalk88 Excel Discussion (Misc queries) 13 September 10th 09 03:42 AM
finding the earliest date in an array of cells Buck Excel Worksheet Functions 3 May 13th 09 12:55 AM
Finding the Location within an Array Sh0t2bts Excel Worksheet Functions 2 December 5th 07 01:06 PM
Help in finding Value in Index Array George Excel Discussion (Misc queries) 20 October 29th 07 11:48 PM
Searching for a criteria in array of cells within an IF statement selvaraj Excel Worksheet Functions 1 July 28th 05 03:36 PM


All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"