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

#### bellawala

##### Board Regular
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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
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)

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!

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

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

Replies
0
Views
117
Replies
3
Views
97
Replies
9
Views
201
Replies
12
Views
207
Replies
2
Views
212

1,219,519
Messages
6,148,748
Members
450,833
Latest member
Andyboi

### 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.

### Which adblocker are you using?

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

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