How do I test if a cell contains a formula or a number?

bellawala

Board Regular
Joined
Aug 20, 2002
Messages
73
Sorry for this simple question, but I can't find the answer. Basically, I'm just trying to see if a cell contains a formula from excel.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

this is the way I know of

select B1
menu Insert / Name / Define
namebox hasFormula
refers to =LEFT(GET.CELL(6,Sheet1!A1),1)="="

this formula in a cell
=hasFormula
will look at the cell to the left and return TRUE or FALSE

you can make it an absolute reference $A$1 (or $A1 or A$1)

kind regards,
Erik

EDIT: OK , learned something today from J WalkenBach :)
my formula would be simpler using
=GET.CELL(48,Sheet1!A1)
 

bellawala

Board Regular
Joined
Aug 20, 2002
Messages
73

ADVERTISEMENT

I think it still doesn't quite work for me.

I should have been clearer in my original post. Let's say A1:A100 contain either dates or formulas that result in dates. In B1:B100 I would like to have TRUE or FALSE values specifying which of cells A1 - A100 are formulas. In truth, I do other actions based on whether or not there are forumlas in A1:A100, so the formatting solution doesn't work for me.

Is that clearer, or am I confused?

thanks for the help!
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Re: I think it still doesn't quite work for me.

I should have been clearer in my original post. Let's say A1:A100 contain either dates or formulas that result in dates. In B1:B100 I would like to have TRUE or FALSE values specifying which of cells A1 - A100 are formulas. In truth, I do other actions based on whether or not there are forumlas in A1:A100, so the formatting solution doesn't work for me.

Is that clearer, or am I confused?

thanks for the help!
you don't need to use it as conditional formatting
see also my post
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Doesn't ASAP or More Func have this function? Can't remember which and they're not on this machine so I can't check.

lenze
 

Forum statistics

Threads
1,141,627
Messages
5,707,495
Members
421,511
Latest member
mgroah1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top