Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
count if the cell contains a word found in another cell | Excel Worksheet Functions | |||
Link from a specific Cell in Excel to a specific para. in Word | Excel Worksheet Functions | |||
Count Specific word in Specific range | Excel Programming | |||
Count Specific word in specific range | Excel Worksheet Functions | |||
how do I make a word typed in a cell go to a specific cell in anot | Excel Discussion (Misc queries) |