Conditional Formatting For only values not formulas

YasserKhalil

Well-known Member
Joined
Jun 24, 2010
Messages
804
Hello everybody
I have mixed data in column A (Formulas & Values (Constants) & Blanks )
I want to apply conditional formatting for only Values ( Not Formulas or Blanks)
In other words Values to be highlighted and Colored.
There is a solution by Go to Special and Select Constants .. But I want that by Conditional Formatting
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

General Ledger

Active Member
Joined
Dec 31, 2007
Messages
460
Conditional Formatting is based on formulas. All you have to do is create a formula that returns TRUE if the entry in a cell is a Value and not a Formula and not Blank.

Check out the CELL function with the TEXT argument like =CELL("TEXT", A1). It can tell you about what is in a cell.
Returns "b" for blank if the cell is empty
Returns "l" for label if the cell contains a text constant
Returns "v" for value if the cell contains anything else.

<tbody>
</tbody>

This might be part of the solution you need:

=CELL("TEXT", A1)<>"b" AND =CELL("TEXT", A1)<>"l"

Best of luck,

G/L
 

skywriter

Well-known Member
Joined
Feb 15, 2014
Messages
1,642
Just in case you have Excel 2013, which I don't, there is a new function called IsFormula which you could use for conditional formatting.
 

YasserKhalil

Well-known Member
Joined
Jun 24, 2010
Messages
804
Conditional Formatting is based on formulas. All you have to do is create a formula that returns TRUE if the entry in a cell is a Value and not a Formula and not Blank.

Check out the CELL function with the TEXT argument like =CELL("TEXT", A1). It can tell you about what is in a cell.
Returns "b" for blank if the cell is empty
Returns "l" for label if the cell contains a text constant
Returns "v" for value if the cell contains anything else.

<tbody>
</tbody>

This might be part of the solution you need:

=CELL("TEXT", A1)<>"b" AND =CELL("TEXT", A1)<>"l"

Best of luck,

G/L

I'm using Office 2007 and the formula =CELL("TEXT", A1) returns value error
I tested Type instead of TEXT but the problem is that it returns v for values and formulas !!
I need help
 

YasserKhalil

Well-known Member
Joined
Jun 24, 2010
Messages
804

ADVERTISEMENT

I used this UDF Function
Code:
Function GetFormula(Cell As Range) As String
   GetFormula = Cell.Formula
End Function
Then I used this formula
Code:
=AND(CELL("Type";C1)<>"b";CELL("Type";C1)<>"l";MID(GetFormula(C1);1;1)<>"=")

At last it worked well
 

Watch MrExcel Video

Forum statistics

Threads
1,109,001
Messages
5,526,199
Members
409,686
Latest member
Tori83

This Week's Hot Topics

Top