Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
In Excel, is there a worksheet function to determine whether a cell contains a formula?
I want to take an action depending on whether cell D7 contains a formula or a constant value. I know I can set up a user-defined function that will do this, but is there a way to check this without setting up a UDF? I have Excel 2002.
Thanks
David H, thanks for that.
If there isn't a worksheet function, then "No" is a fine answer. I had previously set up the function below, but I would prefer if there was a way to check this without resorting to a user-defined function:
Option Explicit
Function IsFormula(rng As Range)
IsFormula = rng(1).HasFormula
End Function
Thanks Chaminda. Good to hear from you, and glad to to see you're still helping foks with Excel.
2 Answers
- voyagerLv 61 decade agoFavorite Answer
Hi aladou, try this. You dont have to use VBA. It is kind of conditional formatting.
http://www.j-walk.com/ss/excel/usertips/tip045.htm
EDIT ===========>
but again, to incorporate that into a formula needs VBA. sorry.
- Anonymous1 decade ago
I don't see one built in so I made a custom function to do it. Open the VB Editor and paste this function into a new module.
Function isformula(ref)
Dim varformula As String
Dim varvalue As String
varformula = ref.Formula
varvalue = ref.Value
isformula = Not (varvalue = varformula)
End Function
Then you can call the function from worksheets in that workbook like this
=isformula(a1)