View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
brit0n brit0n is offline
external usenet poster
 
Posts: 3
Default how tell if cell has formula

I have searched for an answer to that exact question and can't find it. I
wrote a macro to do it which is fine but, like you, not exactly what I wanted.

To explain to those who didn't understand the question, I give the example
of something which CAN be done but not quite the way it's wanted: I wanted to
change cells which were formulas into their values. One of several ways to do
it was to press F2, F9, Enter (edit formula, use F9 hotkey to change to value
and leave value in cell). But that didn't work for a range of cells selected
so I had to use a macro which simply copies the cells and uses paste special
to paste all the values in.

Your requirement has a similar problem. What you and I both want WOULD look
something like this (in some cell other than A1):

= IF ( ISFORMULA(A1), "A1 contains formula", "A1 doesn't contain
formula")

Unfortunately, there is no such spreadsheet function so yuo have to create a
user-defined function to do it. That is basically what the other helpful
answers have given you. Remember to include it with the workbook if you pass
that book/sheet to anyone as they won't HAVE the user-defined function it
requires.

I did once find a way of doing it with embedded Excel functions.
Unfortunately, I have searched all my active workbooks and I can't find it.
And right now, I have some file corrupted which means the Excel help system
won't get me there the way it did when I first used it and as I have an
upgrade from Microsoft I decided to wait until I can install that which will
fix my help system. I seem to remember that it basically used all the other
IS...... functions to elimate all non-formula possibilities - heavy-handed,
but it fit the requirement. You might want to recreate that one if you manage
it before I find it again and post it. In the meantime, you have to use the
user-defined function as given in the other posters' examples.

(Don't forget that if you want simply to VIEW cells with formulas, you can
use Edit-Go To-Special-Formulas. And if you want to use conditional
formatting, you can use the user-defined function.)

I don't know why Microsoft don't include ISFORMULA which imho is a lot more
useful than ISREF !!!!!

"Ian Elliott" wrote:
But preferably I think, I would like some worksheet function that could do
this. Maybe have it check over a range. Are there any functions that can tell
if a cell has a formula or is just a value? I looked at the CELL worksheet
function, but it doesn't look like it can tell.