ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional Formatting if cell content is a formula (https://www.excelbanter.com/excel-worksheet-functions/92505-conditional-formatting-if-cell-content-formula.html)

oldsambvca

Conditional Formatting if cell content is a formula
 
I would like to create a conditional format based on the content of the cell,
rather than the value.

I have a spreadsheet that has empty cells, cells with values of 1 and 2, and
cells that will have values of 0 based on 1-1 or 2-2. I do not want to
highlight the blank cells, I only want to highlight the cells that contain a
formula, even if the formula's value is 0. How can I do that? "Cell Value"
looks at the result of the formula and highlights all blank cells. I cannot
figure out what formula to use to look at the cell content rather than the
cell value.

For example:

Cell A1 is blank -- no highlight
Cell A2 value is 1 -- no highlight
Cell A3 value is 0 because formula is =1-1 -- highlight.

I only want to highlight the last cell because is contains a formula.

Thanks in advance!

Bob Phillips

Conditional Formatting if cell content is a formula
 
Add a custom function like

Function Is(rng As Range) As Boolean
If rng.Count 1 Then
IsFormula = CVErr(xlErrValue)
Else
IsFormula = rng.HasFormula
End If
End Function


and use =IsFormula(A1) in the CF


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"oldsambvca" wrote in message
...
I would like to create a conditional format based on the content of the

cell,
rather than the value.

I have a spreadsheet that has empty cells, cells with values of 1 and 2,

and
cells that will have values of 0 based on 1-1 or 2-2. I do not want to
highlight the blank cells, I only want to highlight the cells that contain

a
formula, even if the formula's value is 0. How can I do that? "Cell

Value"
looks at the result of the formula and highlights all blank cells. I

cannot
figure out what formula to use to look at the cell content rather than the
cell value.

For example:

Cell A1 is blank -- no highlight
Cell A2 value is 1 -- no highlight
Cell A3 value is 0 because formula is =1-1 -- highlight.

I only want to highlight the last cell because is contains a formula.

Thanks in advance!




LanceB

Conditional Formatting if cell content is a formula
 
Format|conditional formatting
In the drop down "Formula is"
=AND(A1=0,A1<"")

Lance

"oldsambvca" wrote:

I would like to create a conditional format based on the content of the cell,
rather than the value.

I have a spreadsheet that has empty cells, cells with values of 1 and 2, and
cells that will have values of 0 based on 1-1 or 2-2. I do not want to
highlight the blank cells, I only want to highlight the cells that contain a
formula, even if the formula's value is 0. How can I do that? "Cell Value"
looks at the result of the formula and highlights all blank cells. I cannot
figure out what formula to use to look at the cell content rather than the
cell value.

For example:

Cell A1 is blank -- no highlight
Cell A2 value is 1 -- no highlight
Cell A3 value is 0 because formula is =1-1 -- highlight.

I only want to highlight the last cell because is contains a formula.

Thanks in advance!



All times are GMT +1. The time now is 05:36 AM.

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