Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 110
Default Is Cell a formula or a value

I would like to create a formula that will tell me if another cell is a value
or if it contains a formula in it? So for example in cell A2, I want to know
is cell A1 has "=B1+B2" or does it have a 5 in it. I'm assuming it would be
some kind of IF statement, but not sure much beyond that.

thx.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Is Cell a formula or a value

Use this tiny UDF:

Public Function isformula(r As Range) As Boolean
isformula = r.HasFormula
End Function

So
=isformula(A1)
will display TRUE if A1 contains a formula, otherwise FALSE
--
Gary''s Student - gsnu200799
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 110
Default Is Cell a formula or a value

I'm getting a #NAME? error. When I look at my total list of functions I
don't see ISFORMULA. I'm running Excell 2003 -- is it a version issue?

"Gary''s Student" wrote:

Use this tiny UDF:

Public Function isformula(r As Range) As Boolean
isformula = r.HasFormula
End Function

So
=isformula(A1)
will display TRUE if A1 contains a formula, otherwise FALSE
--
Gary''s Student - gsnu200799

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Is Cell a formula or a value

No, its simply a User Defined Function (UDF).


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function:

=isformula(A1) in some cell

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx


--
Gary''s Student - gsnu200800
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 110
Default Is Cell a formula or a value

That worked!!! thank you so much.

"Gary''s Student" wrote:

No, its simply a User Defined Function (UDF).


UDFs are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the UDF will be saved with it.

To use the UDF from the normal Excel window, just enter it like a normal
Excel Function:

=isformula(A1) in some cell

To remove the UDF:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about UDFs, see:

http://www.cpearson.com/excel/Writin...ionsInVBA.aspx


--
Gary''s Student - gsnu200800



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
How can I make a blank cell in a formula cell with a range of cell Vi Excel Discussion (Misc queries) 5 June 21st 07 02:46 PM
copy formula down a column and have cell references change within formula brad New Users to Excel 5 May 13th 07 04:38 PM
adding a formula in a cell but when cell = 0 cell is blank Mike T Excel Worksheet Functions 5 May 31st 05 01:08 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


All times are GMT +1. The time now is 07:27 PM.

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"