Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Simple Excel Ques?

Hi everyone,

Say I have in cell B2 a function like this: "=If(c2=5,1,0)" OR this
"=1+34*x" and I want to check from cell F5 to see if what I have in B2
is like this:

if(or(b2 = "=If",b2="=1"),.....)

I don't want to put the whole function just the 1st part of it; if it
has "=If" or "=1"

How can I do so?

Thanks,
Mike

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Simple Excel Ques?

Add a UDF

Function IsFormula(rng as Range)
If rng.Coount = 1 Then
IsFormula = rng.HasFormula
End If
End SUb

and use like

=IF(Isformula(B2),....)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Mike" wrote in message
oups.com...
Hi everyone,

Say I have in cell B2 a function like this: "=If(c2=5,1,0)" OR this
"=1+34*x" and I want to check from cell F5 to see if what I have in B2
is like this:

if(or(b2 = "=If",b2="=1"),.....)

I don't want to put the whole function just the 1st part of it; if it
has "=If" or "=1"

How can I do so?

Thanks,
Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Simple Excel Ques?

Directly though Excel (not using VBA) I am affraid you can not do what you
are attempting. You can only read the return value of the function in the
cell, not the text of the function itself... Just wondering, how is it you
will not know what function that you have in the cell? maybe there is some
way to work around this...
--
HTH...

Jim Thomlinson


"Mike" wrote:

Hi everyone,

Say I have in cell B2 a function like this: "=If(c2=5,1,0)" OR this
"=1+34*x" and I want to check from cell F5 to see if what I have in B2
is like this:

if(or(b2 = "=If",b2="=1"),.....)

I don't want to put the whole function just the 1st part of it; if it
has "=If" or "=1"

How can I do so?

Thanks,
Mike


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Simple Excel Ques?

Unless you want to write a user defined function in VBA, you can't check the
formula of another cell using built in worksheet formulas.

Public Function checkformula(cell as Range)
set Target = Cell(1)
sForm = Target.Formula
if Left(sForm,3) = "=IF" then
checkformula = True
else
checkformula = false
end if
End Function

placed in a general module then in the worksheet

=Checkformula(B2)

alter the code to do exactly what you want.

--
Regards,
Tom Ogilvy


"Mike" wrote:

Hi everyone,

Say I have in cell B2 a function like this: "=If(c2=5,1,0)" OR this
"=1+34*x" and I want to check from cell F5 to see if what I have in B2
is like this:

if(or(b2 = "=If",b2="=1"),.....)

I don't want to put the whole function just the 1st part of it; if it
has "=If" or "=1"

How can I do so?

Thanks,
Mike


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
Dat. Validaation - simple ques LiAD Excel Worksheet Functions 5 July 7th 09 04:06 PM
HOW: estb. simple/1 ques. survey? Boswell Excel Discussion (Misc queries) 0 February 1st 07 12:00 AM
ques maya Excel Worksheet Functions 1 March 5th 05 02:49 PM
thanks...But I had another ques monika Excel Programming 0 April 1st 04 03:04 AM
formatting ques... mike Excel Programming 1 October 28th 03 03:20 PM


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