ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Value or formula? (https://www.excelbanter.com/excel-discussion-misc-queries/126210-value-formula.html)

Eric

Value or formula?
 
Does anyone know how to differentiate the cell formed by a value or a formula?
such as in cell a1 = 7 [value only] and in cell b1 = 3 + 4 [any formula]
If the cell contains value, then return 0, else
If the cell contains formula, then reurn 1.
In this case, a2 = 0 [return], because a1 contains value and
b2 = 1 [return], because b1 contains formula
Does anyone have any suggestion?
Thank you in advance
Eric

JMB

Value or formula?
 
See your other post.

"Eric" wrote:

Does anyone know how to differentiate the cell formed by a value or a formula?
such as in cell a1 = 7 [value only] and in cell b1 = 3 + 4 [any formula]
If the cell contains value, then return 0, else
If the cell contains formula, then reurn 1.
In this case, a2 = 0 [return], because a1 contains value and
b2 = 1 [return], because b1 contains formula
Does anyone have any suggestion?
Thank you in advance
Eric


Gary''s Student

Value or formula?
 
How about a tiny UDF:

Function got_formula(r As Range) As Integer
If r.HasFormula Then
got_formula = 1
Else
got_formula = 0
End If
End Function


if you are not familiar with VBA, see:

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


--
Gary's Student
gsnu200701


"Eric" wrote:

Does anyone know how to differentiate the cell formed by a value or a formula?
such as in cell a1 = 7 [value only] and in cell b1 = 3 + 4 [any formula]
If the cell contains value, then return 0, else
If the cell contains formula, then reurn 1.
In this case, a2 = 0 [return], because a1 contains value and
b2 = 1 [return], because b1 contains formula
Does anyone have any suggestion?
Thank you in advance
Eric


Eric

Value or formula?
 
Thank everyone for suggestion

I still don't understand how to create a User Defined Functions after
reading the link, it shows only the macro, but it does not talk much about
User Defined Functions. Could you please give me more suggestion?
Thank for your help
Eric

"Gary''s Student" wrote:

How about a tiny UDF:

Function got_formula(r As Range) As Integer
If r.HasFormula Then
got_formula = 1
Else
got_formula = 0
End If
End Function


if you are not familiar with VBA, see:

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


--
Gary's Student
gsnu200701


"Eric" wrote:

Does anyone know how to differentiate the cell formed by a value or a formula?
such as in cell a1 = 7 [value only] and in cell b1 = 3 + 4 [any formula]
If the cell contains value, then return 0, else
If the cell contains formula, then reurn 1.
In this case, a2 = 0 [return], because a1 contains value and
b2 = 1 [return], because b1 contains formula
Does anyone have any suggestion?
Thank you in advance
Eric



All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com