Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default If for word in sentence

I download various files from a site which are all the same format starting as shown
below. The first row is always blank. The column A cells below this row all have text data
which can be made up of several words making up a phrase or sentence. All wihout fail
start with the word Information. There are two types of file one which has 12 rows
starting with this word and those which have 13. Where there are 13 the extra phrase is
the one shown in A8 which is the only one phrase I have shown in its entirety. There is a
lot of data after row 14 but it is not relevant for this exercise. What I need to do in
code is tio identify whether we have a file with the 12 rows starting with information or
thirteen ie

if (rows 2 to 14 start with the word information) then
do this
else

I hope this makes sense as I would value any guidance on the best way to do this when the
word is the start of a phrase or sentence.


A1 Blank row
A2 Information: This is the Field Data etc
A3 Information: To upload this file etc
A4 Information: You MUST NOT change the etc
A5 Information: Every line of data MUST start with '' etc
A6 Information: The entries for etc
A7 Information: 'Area Eligible for LFASS 2009' is only applicable for Permanent land.
A8 Information: For non LFA land do not enter a value in the column 'Area Eligible for
LFASS 2009'.

A9 Information: Ensure that a blank line etc
A10 Information: Always use the code list etc
A11 Information: Always save this file before uploading (as a .CSV file) etc
A12 Information: You MUST start a new sheet etc
A13 Information: These details are for etc
A14 Information:
A15
A16
etc
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default If for word in sentence

You can count how many lines begin with "Information" using this...

InfoCount = WorksheetFunction.CountIf(Range("A1:A14"), "Information*")

--
Rick (MVP - Excel)


"Graham H" wrote in message
...
I download various files from a site which are all the same format starting
as shown below. The first row is always blank. The column A cells below
this row all have text data
which can be made up of several words making up a phrase or sentence. All
wihout fail start with the word Information. There are two types of file
one which has 12 rows starting with this word and those which have 13.
Where there are 13 the extra phrase is the one shown in A8 which is the
only one phrase I have shown in its entirety. There is a lot of data after
row 14 but it is not relevant for this exercise. What I need to do in code
is tio identify whether we have a file with the 12 rows starting with
information or thirteen ie

if (rows 2 to 14 start with the word information) then
do this
else

I hope this makes sense as I would value any guidance on the best way to
do this when the word is the start of a phrase or sentence.


A1 Blank row
A2 Information: This is the Field Data etc
A3 Information: To upload this file etc
A4 Information: You MUST NOT change the etc
A5 Information: Every line of data MUST start with '' etc
A6 Information: The entries for etc
A7 Information: 'Area Eligible for LFASS 2009' is only applicable for
Permanent land.
A8 Information: For non LFA land do not enter a value in the column 'Area
Eligible for LFASS 2009'.

A9 Information: Ensure that a blank line etc
A10 Information: Always use the code list etc
A11 Information: Always save this file before uploading (as a .CSV file)
etc
A12 Information: You MUST start a new sheet etc
A13 Information: These details are for etc
A14 Information:
A15
A16
etc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default If for word in sentence

Many thanks for your help Rick

Graham

Rick Rothstein wrote:
You can count how many lines begin with "Information" using this...

InfoCount = WorksheetFunction.CountIf(Range("A1:A14"), "Information*")

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
Find a word in a sentence Chicago2Paris Excel Worksheet Functions 10 October 29th 09 06:29 PM
If for word in sentence Paul C Excel Programming 1 April 9th 09 09:40 PM
Link a cell to a word in a sentence Brenelder Excel Discussion (Misc queries) 1 March 14th 08 08:36 PM
how to keep a word of same sentence starting w a capital next lin dottie Excel Worksheet Functions 1 September 20th 07 05:32 PM
Extract the n word of a sentence in a cell crazy_vba[_3_] Excel Programming 6 April 22nd 06 06:53 PM


All times are GMT +1. The time now is 01:54 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"