Formulas or not ??

B

Brian Ferris

Good morning guys,

I woant a formula which when referring to another cell
verifies whether this cell contains a numerical value or
otherwise a normal numerical number

Is this possible ?

Thanks in dvance,
Brian
 
J

Jan Karel Pieterse

Hi Brian,
I woant a formula which when referring to another cell
verifies whether this cell contains a numerical value or
otherwise a normal numerical number

=IF(ISNUMBER(A1),"A1 contains a number","A1 Does not contain a number")

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 
N

Norman Harker

Hi Brian!

I'm not sure whether I'm interpreting you correctly.

If a number is entered as text (eg by preceeding with an apostrophe) then

=ISNUMBER(A1)
will return FALSE

But:
=ISNUMBER(--A1)
will return TRUE

However, if A1 is an empty cell, then ISNUMBER(--A1) will return TRUE which
may not be what you want.

So for testing, you might use something like:

=IF(ISNUMBER(A1),"A number",IF(ISBLANK(A1),"Blank",IF(ISNUMBER(--A1),"Text
Number","Text")))

--
--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
[email protected]
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
N

Norman Harker

Hi Brian!

If you are wanting to test whether a cell contains a formula you can use the
User Defined Function:

Function ISFORMULA(MyCell As Range) As Boolean
ISFORMULA = MyCell.HasFormula
End Function

--
--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
[email protected]
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
B

Brian Ferris

But what i mean is ...

if in a particular cell, there is a valid number but which
is a result of another formula, I want it to return false
and not true... I want tru to show ONLY for manually input
variables and not for formulas returning a number..

Hope I made myself clear

Thanks again,
Brian
 
B

Brioan Ferris

Thanks for the suggestion...

Please guide me as to where I should place this
function... I am green to Visual Basic

Your help will be appreiated.

Thanks,
Brian
 
D

Dave Peterson

Since you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:
Open your workbook
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel and test it out.
 
Top