View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default FORMULA VS VALUE

Try this tiny UDF:

Function isformula(r As Range) As Boolean
isformula = r.HasFormula
End Function

so that if A1 contains:
1
and A2 contains:
=1
then =isformula(A1) will return FALSE
and =isformula(A2) will return TRUE


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx




--
Gary''s Student - gsnu200817


"Kathy Niebur" wrote:

Is there a function in Excel or functions I could group together to determine
if the contents of a given cell are a formula vs. a value ? For example, I
would want to evaluate the contents of a cell displaying 3,450 to determine
if that was a number typed into the cell (a numeric value) vs the result of a
formula in the cell (=E5+E6) for example. I know how to manually display the
formulas in a worksheet. I want to write a formula to CHECK for the presence
or absence of a formula in a given cell. Being able to check for the EXACT
formula would be even better. For example, =IF(B3<"=E5+E6","NOT
CORRECT',"CORRECT")

Any help?