Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
scott
 
Posts: n/a
Default Formula to a number can you tell

In cell a1 I have a formula. At times whole numbers are entered in this cell
replacing the formula. In a seperate cell is it possible to distinguish if
there is a formula or number in cell a1 using another formula. I do not want
to track changes I just would liek to know what is in cell a1

Thanks
Scott
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Formula to a number can you tell

You can create a userdefined function that returns true or false if the cell
contains a formula:

Option Explicit
Function HasFormula(rng As Range) As Boolean
Set rng = rng.Cells(1)
HasFormula = rng.HasFormula
End Function

Then you can include that test in your formula:

=hasformula(a1)

But if you start entering 5 as =5, then this won't work. It actually looks for
any old formula.

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

scott wrote:

In cell a1 I have a formula. At times whole numbers are entered in this cell
replacing the formula. In a seperate cell is it possible to distinguish if
there is a formula or number in cell a1 using another formula. I do not want
to track changes I just would liek to know what is in cell a1

Thanks
Scott


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
chillihawk
 
Posts: n/a
Default Formula to a number can you tell

Its possible to do this. I can't think of an inbuilt function to do it
however so you'd have to write your own, something like this:

Public Function isFormula(ByRef p_rngTgt as Range) as Boolean

isFormula = p_rngTgt.HasFormula

End Function

If you only need to know however then if you do CTRL+` you toggle
between formulas and values and you can just see.

HTH

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach
 
Posts: n/a
Default Formula to a number can you tell

Enter this UDF into a standard module. Then in some cell where you want the
indicator to be, enter "=IsFormula(A1)" without the quotes. The result
will be "True" if there is a formula in A1 and "False" if not. HTH Otto
Function IsFormula(r As Range) As Boolean

Application.Volatile True

IsFormula = r.HasFormula

End Function

"scott" wrote in message
...
In cell a1 I have a formula. At times whole numbers are entered in this
cell
replacing the formula. In a seperate cell is it possible to distinguish if
there is a formula or number in cell a1 using another formula. I do not
want
to track changes I just would liek to know what is in cell a1

Thanks
Scott



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to limit the size of a number result in a cell? Pheasant Plucker® Excel Discussion (Misc queries) 3 February 2nd 06 11:14 AM
How do I enter formula that adds a range if less than a number or Rose M Excel Worksheet Functions 2 December 21st 05 08:30 PM
Formula reads date as number pete5761 Excel Discussion (Misc queries) 1 December 16th 05 09:50 PM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM


All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"