Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excluding cells with highlighted text from formulas

Status
Not open for further replies.

cm80

Technical User
May 3, 2001
85
US
Is there any way to exclude cells with highlighted text from formulas.
e.g.
I have a column with the following values

First 1
Second 2
Third 3
Fourth 4
Fifth 5

Total 15


Is there any way to put a formula in the total cell so that cells with bold text are not included,
e.g. to give the following result to the example above

First 1
Second 2
Third 3
Fourth 4
Fifth 5

Total 10

Any help would be appreciated. Thanks
 
Not as such. It would be possible to do with a UDF (User-Defined Function) using VBA.

However I would suggest a different approach. Instead of bolding the cell, use conditional formatting to do the bolding based on the presence of a value in column "C" (in this example.) Then use SUMIF while testing for a value in column "C".

In other words, use this formula in B6:
[blue]
Code:
  =SUMIF(C1:C5,"",B1:B5)
[/color]

and use this for conditional formtting in column B (Highlight column B and select Format/Conditional Formatting from the menu. Then change the first combo to "Formula is" and enter the formula. Click "Format..." and choose Bold):
[blue]
Code:
  =C1<>&quot;&quot;
[/color]

Now when you put anything in column C (E.g., the word &quot;Exclude&quot;), the number will be bolded and the total will exclude the amount.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top