ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refine search criteria for Find Method (https://www.excelbanter.com/excel-programming/335015-refine-search-criteria-find-method.html)

ExcelMonkey

Refine search criteria for Find Method
 
I am using the Find method to search for the N() function in a cell. It
works fine, except it also picks up any other function that ends with an N
such as:Median, Mean, etc. The same thing happens with I search for the T()
function as well. It picks up SUMPRODUCT, OFFSET etc.

How can I revised the search terms in the Find Method to ensure that I only
get N()? Can I employ wildcards in the search term?


VolFormType = "N"
SpecFormula = VolFormType & "("
With rng
Set C = .Find(SpecFormula, LookIn:=xlFormulas)
If Not C Is Nothing Then
HasSpecificFormula = True
End If
End With


Jim Cone

Refine search criteria for Find Method
 
Try adding a leading space...
VolFormType = " N"

Jim Cone
San Francisco, USA


"ExcelMonkey" wrote in message
...
I am using the Find method to search for the N() function in a cell. It
works fine, except it also picks up any other function that ends with an N
such as:Median, Mean, etc. The same thing happens with I search for the T()
function as well. It picks up SUMPRODUCT, OFFSET etc.
How can I revised the search terms in the Find Method to ensure that I only
get N()? Can I employ wildcards in the search term?

VolFormType = "N"
SpecFormula = VolFormType & "("
With rng
Set C = .Find(SpecFormula, LookIn:=xlFormulas)
If Not C Is Nothing Then
HasSpecificFormula = True
End If
End With

Dave Peterson

Refine search criteria for Find Method
 
You can use wild cards in Edit|Find (or the VBA equivalent).

But what would you search for???

=n()
=if(n(...
=if(a1=b1,n(...
=a1+n(...
=a1-n(...
=a1*n(...
=a1^n(...
=a1/n(...

So you could look for = ( + - * / ^ ,

I'm sure you can think of more!

And make sure you exclude strings.

=if(a1=b1,"Please do this by then(before tuesday)","")

It ain't easy writing the parser you want.

Good luck.

ExcelMonkey wrote:

I am using the Find method to search for the N() function in a cell. It
works fine, except it also picks up any other function that ends with an N
such as:Median, Mean, etc. The same thing happens with I search for the T()
function as well. It picks up SUMPRODUCT, OFFSET etc.

How can I revised the search terms in the Find Method to ensure that I only
get N()? Can I employ wildcards in the search term?

VolFormType = "N"
SpecFormula = VolFormType & "("
With rng
Set C = .Find(SpecFormula, LookIn:=xlFormulas)
If Not C Is Nothing Then
HasSpecificFormula = True
End If
End With


--

Dave Peterson


All times are GMT +1. The time now is 02:17 AM.

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