Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default count 1st cell and last cell that contain specific word

From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default count 1st cell and last cell that contain specific word

Hi
Assuming Your column A data has a heading

Sub tester()
Dim firstCell As Range, lastCell As Range
With Range("A:A")
Set firstCell = .Find("grp", SearchDirection:=xlNext)
Set lastCell = .Find("grp", SearchDirection:=xlPrevious)
End With
MsgBox "First Cell address is " & firstCell.Address
MsgBox "Last Cell address is " & lastCell.Address
End Sub

The first cell tested is A2 for firstcell and last row of data for
lastcell.
Check the find method Help if you want to specify different start
cells for searching.
regards
Paul

On Feb 22, 2:06*pm, "crapit" wrote:
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

* * * *A * * * *B * * * *C
1
2 * grp
3 * grp
4
5 * grp
6
7 * hex
8 * hex
9 * hex
10 grp
11 grp


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default count 1st cell and last cell that contain specific word

Select column A and run:

Sub find_um()
firstt = False
v = "grp"
For Each r In Selection
If v = r.Value Then
If firstt Then
lastone = r.Address
Else
lastone = r.Address
firstone = r.Address
firstt = True
End If
End If
Next
MsgBox (firstone & Chr(10) & lastone)
End Sub

--
Gary''s Student - gsnu2007d


"crapit" wrote:

From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default count 1st cell and last cell that contain specific word

err, possible not to use macro? formula

wrote in message
...
Hi
Assuming Your column A data has a heading

Sub tester()
Dim firstCell As Range, lastCell As Range
With Range("A:A")
Set firstCell = .Find("grp", SearchDirection:=xlNext)
Set lastCell = .Find("grp", SearchDirection:=xlPrevious)
End With
MsgBox "First Cell address is " & firstCell.Address
MsgBox "Last Cell address is " & lastCell.Address
End Sub

The first cell tested is A2 for firstcell and last row of data for
lastcell.
Check the find method Help if you want to specify different start
cells for searching.
regards
Paul

On Feb 22, 2:06 pm, "crapit" wrote:
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default count 1st cell and last cell that contain specific word

Array enter
=MIN(IF(A2:A21="a",ROW(A2:A21)))
=Max(IF(A2:A21="a",ROW(A2:A21)))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default count 1st cell and last cell that contain specific word

Hi
Post the question in

microsoft.public.excel.worksheetfunctions

to avoid disappointment!
Paul

On Feb 22, 2:31*pm, "crapit" wrote:
err, possible not to use macro? formula

wrote in message

...
Hi
Assuming Your column A data has a heading

Sub tester()
Dim firstCell As Range, lastCell As Range
*With Range("A:A")
* *Set firstCell = .Find("grp", SearchDirection:=xlNext)
* *Set lastCell = .Find("grp", SearchDirection:=xlPrevious)
End With
* * MsgBox "First Cell address is " & firstCell.Address
* * MsgBox "Last Cell address is " & lastCell.Address
End Sub

The first cell tested is A2 for firstcell and last row of data for
lastcell.
Check the find method Help if you want to specify different start
cells for searching.
regards
Paul

On Feb 22, 2:06 pm, "crapit" wrote:



From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?


A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default count 1st cell and last cell that contain specific word

do i need to put the array across the same row
"Don Guillett" wrote in message
...
Array enter
=MIN(IF(A2:A21="a",ROW(A2:A21)))
=Max(IF(A2:A21="a",ROW(A2:A21)))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default count 1st cell and last cell that contain specific word

This is an Array formula that could be put anywhere on the worksheet. It
refers to the indicated range.
Instead of entering/editing with just ENTER, hold down the ctrl & shift keys
and touch enter at the same time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
do i need to put the array across the same row
"Don Guillett" wrote in message
...
Array enter
=MIN(IF(A2:A21="a",ROW(A2:A21)))
=Max(IF(A2:A21="a",ROW(A2:A21)))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default count 1st cell and last cell that contain specific word

If the reference is in another worksheet, can I just change to =MIN(IF("abc
num"(A2:A21)="a",ROW("abc num"(A2:A21))))
"Don Guillett" wrote in message
...
This is an Array formula that could be put anywhere on the worksheet. It
refers to the indicated range.
Instead of entering/editing with just ENTER, hold down the ctrl & shift
keys and touch enter at the same time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
do i need to put the array across the same row
"Don Guillett" wrote in message
...
Array enter
=MIN(IF(A2:A21="a",ROW(A2:A21)))
=Max(IF(A2:A21="a",ROW(A2:A21)))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a specific
word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp








  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default count 1st cell and last cell that contain specific word

Pls ignore the worksheet Qs. If I need to use the min and max in a range
e.g sum('abc ge'!a3:a33), where a3 is the value in MIN array and a33 in MAX
array,is that possible

"crapit" wrote in message
...
If the reference is in another worksheet, can I just change to
=MIN(IF("abc num"(A2:A21)="a",ROW("abc num"(A2:A21))))
"Don Guillett" wrote in message
...
This is an Array formula that could be put anywhere on the worksheet. It
refers to the indicated range.
Instead of entering/editing with just ENTER, hold down the ctrl & shift
keys and touch enter at the same time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
do i need to put the array across the same row
"Don Guillett" wrote in message
...
Array enter
=MIN(IF(A2:A21="a",ROW(A2:A21)))
=Max(IF(A2:A21="a",ROW(A2:A21)))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a
specific word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp












  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default count 1st cell and last cell that contain specific word


More info. Your OP asked to determine TEXT in a column. In the future,
ALWAYS state your requirement in the FIRST post so time is not wasted. I
don't understand what you want.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
Pls ignore the worksheet Qs. If I need to use the min and max in a range
e.g sum('abc ge'!a3:a33), where a3 is the value in MIN array and a33 in
MAX array,is that possible

"crapit" wrote in message
...
If the reference is in another worksheet, can I just change to
=MIN(IF("abc num"(A2:A21)="a",ROW("abc num"(A2:A21))))
"Don Guillett" wrote in message
...
This is an Array formula that could be put anywhere on the worksheet. It
refers to the indicated range.
Instead of entering/editing with just ENTER, hold down the ctrl & shift
keys and touch enter at the same time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
do i need to put the array across the same row
"Don Guillett" wrote in message
...
Array enter
=MIN(IF(A2:A21="a",ROW(A2:A21)))
=Max(IF(A2:A21="a",ROW(A2:A21)))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"crapit" wrote in message
...
From a column e.g "A"
How to determine the 1st cell and the last cell that contain a
specific word?

A B C
1
2 grp
3 grp
4
5 grp
6
7 hex
8 hex
9 hex
10 grp
11 grp











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
count if the cell contains a word found in another cell Go Bucks!!![_2_] Excel Worksheet Functions 2 July 28th 09 02:41 PM
Link from a specific Cell in Excel to a specific para. in Word CathyK Excel Worksheet Functions 0 August 10th 06 04:40 PM
Count Specific word in Specific range [email protected] Excel Programming 1 May 16th 06 10:55 AM
Count Specific word in specific range [email protected] Excel Worksheet Functions 2 May 16th 06 10:30 AM
how do I make a word typed in a cell go to a specific cell in anot Lmatarazzo Excel Discussion (Misc queries) 3 April 21st 05 04:29 AM


All times are GMT +1. The time now is 01:22 PM.

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"