Excel 2010 function to test if a cell has a formula or is input (number or text)

jerry12302

Active Member
Joined
Apr 18, 2005
Messages
456
Office Version
  1. 2010
Platform
  1. Windows
I use Excel 2010, I have been searching for a solution to determine whether a cell contains a formula of any kind, or is just hard input (value or text.)

Isformula is not included in Excel 2010, nor is any use of Hasformula.

I tried suggested UDF solutions, such as

Function IsFormula(cell_ref As Range)
IsFormula = cell_ref.HasFormula
End Function

None have worked, I get a #NAME? Error every time, and my workbook is saved as an xlsm, macro enabled. I placed the Function in a module, under General.

Has anyone found a solution that works in Excel 2010???
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
That should work as long as you have macros enabled, it's a normal module not a worksheet/ThisWorkbook module, and you didn't give the module the same name as the function.
 
Upvote 0
That should work as long as you have macros enabled, it's a normal module not a worksheet/ThisWorkbook module, and you didn't give the module the same name as the function.
I inserted a normal module, and didn't name it, so it is still Module 1.

The macros are enabled (I ran another test macro in the same module to be sure.)
 
Upvote 0
Can you show us exactly how/where you are calling this UDF?

If right on the sheet, show use the formula you are entering.
If in VBA code, please show us the code calling it.
 
Upvote 0
Also, I assume the code is in the same workbook, not in another workbook such as your personal macro workbook? If it's in a different one, you need to include the workbook name in the function call.
 
Upvote 0
Can you show us exactly how/where you are calling this UDF?

If right on the sheet, show use the formula you are entering.
If in VBA code, please show us the code calling it.
It's in VBA code....

Function IsFormula(cell_ref As Range)
IsFormula = cell_ref.HasFormula
End Function
 
Upvote 0
Also, I assume the code is in the same workbook, not in another workbook such as your personal macro workbook? If it's in a different one, you need to include the workbook name in the function call.
Yes, same workbook.
 
Upvote 0
If you type =IsF in a cell, does the function list dropdown show your function?
 
Upvote 0
If you type =IsF in a cell, does the function list dropdown show your function?
Yes, it's all in lowercase, but it is there. I double click on it, and finish it, like =isformula(J3)

I get a #REF! error now. Similar UDF functions I tried gave me a #NAME? error.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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
Back
Top