ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula for detecting a certain pattern in a particular row or column? (https://www.excelbanter.com/excel-programming/382730-formula-detecting-certain-pattern-particular-row-column.html)

[email protected]

Formula for detecting a certain pattern in a particular row or column?
 
Hi,

I wonder if there's a formula for detecting a certain pattern in a
particular row or column?

Any of the cells within the range of "start", and "end" would trigger
"do XXX"


Presudo code would be:

If I can see "X" in range(start, end) Then
do XXX
Else
do OOO
End If


Thanks,
Jacky


Tom Ogilvy

Formula for detecting a certain pattern in a particular row or col
 
Dim rStart as Range, rEnd as Range
Set rStart = Range("A1")
Set rEnd = rStart.Specialcells(xlLast)
If Application.countif(range(rstart, rend),"X") 0 Then
XXX
Else
OOO
End If

if X is a substring

If Application.countif(range(rstart, rend),"*X*") 0 Then

Assumes XXX and OOO are the names of macros in the same module

--
Regards,
Tom Ogilvy

" wrote:

Hi,

I wonder if there's a formula for detecting a certain pattern in a
particular row or column?

Any of the cells within the range of "start", and "end" would trigger
"do XXX"


Presudo code would be:

If I can see "X" in range(start, end) Then
do XXX
Else
do OOO
End If


Thanks,
Jacky



[email protected]

Formula for detecting a certain pattern in a particular row or col
 
On Feb 8, 12:41 am, Tom Ogilvy
wrote:
Dim rStart as Range, rEnd as Range
Set rStart = Range("A1")
Set rEnd = rStart.Specialcells(xlLast)
If Application.countif(range(rstart, rend),"X") 0 Then
XXX
Else
OOO
End If



Hi Tom,

Thanks for the code. I am using Excel 2000, where do I type all these
code in? Currently, I am using short codes in the cells like "=
+COUNTIF(E18:IV101, "O")"



All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com