View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default If Statement Checking Formula NOT Value in a Cell

Try the small UDF:

Function from_whence(r As Range) As Boolean
Dim s As String
from_whence = False
s = r.Formula
If InStr(s, "Sheet2") 0 Then
from_whence = True
End If
End Function

=from_whence(D1) returns False if D1 contains
=COUNTIF(A1:A100,"<20")-COUNTIF(A1:A100,"<9")
but will return True if D1 contains:
=COUNTIF(A1:A100,"<10")*Sheet2!A1

See:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

if you are not familiar with VBA.

--
Gary's Student
gsnu200702


"Marathon" wrote:

Hi,

Is it possible to write an "IF" statement which checks not the value of the
cell, but whether the formula in cell gets data from a certain "Sheet".

Let say, in "A1" cell of the "Sheet4" I have this formula
"=Sheet1!A1+Sheet2!A1+Sheet3!A1". I would like to check whether the formula
in cell "A1" of "Sheet4" uses data from "Sheet2". Is this possible?

Thanks.