ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Function to detect type of cell contents (https://www.excelbanter.com/excel-worksheet-functions/126747-function-detect-type-cell-contents.html)

Mark

Function to detect type of cell contents
 
Is there a formula or function that I can use that will tell me if a cell's
contents contain plain text or number that is input, or if it is a formula
that is generating the results.

Thanks



Bernard Liengme

Function to detect type of cell contents
 
This user defined function will do the job:
Function Whattype(mycell)
If mycell.HasFormula Then
Whattype = "Formula"
Else
Whattype = "Input"
End If
End Function

Call it with =Whattype(a1)
If you are unfamiliar with VBA see David McRitchie's site on "getting
started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm
But feel free to return here with more questions , or contact me direct
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Mark" wrote in message
et...
Is there a formula or function that I can use that will tell me if a
cell's contents contain plain text or number that is input, or if it is a
formula that is generating the results.

Thanks





Mark

Function to detect type of cell contents
 
Bernard, thanks for this. I would need this to check a series of cells in a
column. How do I include that logic? I am new to VBA but willing to learn.
Mark
"Bernard Liengme" wrote in message
...
This user defined function will do the job:
Function Whattype(mycell)
If mycell.HasFormula Then
Whattype = "Formula"
Else
Whattype = "Input"
End If
End Function

Call it with =Whattype(a1)
If you are unfamiliar with VBA see David McRitchie's site on "getting
started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm
But feel free to return here with more questions , or contact me direct
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Mark" wrote in message
et...
Is there a formula or function that I can use that will tell me if a
cell's contents contain plain text or number that is input, or if it is a
formula that is generating the results.

Thanks







Bernard Liengme

Function to detect type of cell contents
 
Copy the formula down the column
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Mark" wrote in message
t...
Bernard, thanks for this. I would need this to check a series of cells in
a column. How do I include that logic? I am new to VBA but willing to
learn.
Mark
"Bernard Liengme" wrote in message
...
This user defined function will do the job:
Function Whattype(mycell)
If mycell.HasFormula Then
Whattype = "Formula"
Else
Whattype = "Input"
End If
End Function

Call it with =Whattype(a1)
If you are unfamiliar with VBA see David McRitchie's site on "getting
started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm
But feel free to return here with more questions , or contact me direct
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Mark" wrote in message
et...
Is there a formula or function that I can use that will tell me if a
cell's contents contain plain text or number that is input, or if it is
a formula that is generating the results.

Thanks










All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com