Conditional formatting to hide cell content even when printed - excel

I would like to set up a conditional formatting setting that would hide the contents (the cell should look blank) if the cell's contents is equal to another cell. Does anyone know of a function to do this? I tried just making the font the same color as the background (gray, in this case), but unfortunately when this is printed, there is some sort of residue shadow left over from the text.
Here is what happens when I do gray on gray (they are supposedly the same color):
I am using Excel 2008 on the Mac.

Below in A2 we have the conditional formatting that hides the content of that cell if it is equal to B2.
In Conditional Formatting create the following rule: =$A$2=$B$2, then press Format...
On the Format menu, click Cells, and then click the Number tab.
Under Category, click Custom.
In the Type box, type ;;; (that is, three semicolons in a row), and then click OK.

another way around this is a hack but it should work:
have two sheets, data and view
base your conditional formatting on the view sheet off of values in the data sheet (not sure if this is an option...)
use if statements in each cell that say something like if(dataCell=matchCell, "", dataCell)

I suspect that the printing problem is not so much a problem with Excel, but a feature of the printer.
Printer manufacturers obviously want to get the "best" result that they can on a printed page. Some will optimise colour by doing things like making smaller volumes of print (e.g. charters and lines) a bit darker and large areas (e.g. cell backgrounds a bit lighter). This is so that when they are side-by-side they look like the same colour. However, when printed on top of one another as per your case, you get a residual effect.
This stems from a well known effect that for any given colour, a large area of that colour will look darker than a small area of the exact same colour. There are other effects that give this illusion - such as the background and nearby colours. For an example - that is not exactly the same as yours - but illustrates the illusion, search the web for "adelson's checkerboard" and read the explanations.
In any event, the solution proposed by mpalanco (use conditional formatting of three semi-colons) is the easiest way to achieve clean result - every time, printed to paper, printed to pdf, on screen and any other form.

You are on right track to resolve this. You just need to make the font color white this will not show the value when printed on paper unless the paper is not white. I have done this with Office 2007.

So I think that to get the effect that you would like, you will need to use a macro to check the contents of the cell. A worksheet_change event should work well.
To get this code functional, I will need you to tell me the range of cells whose values should be hidden, and the range of cells that we are checking the values against.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range.Address Then
For Each VariantValue in OtherRange
If Range.Value = VariantValue Then
Range.NumberFormat = ";;;"
End If
Next
End if
End Sub
http://www.extendoffice.com/documents/excel/919-excel-hide-cell-contents.html
http://www.ozgrid.com/VBA/run-macros-change.htm

Related

Is there a way to clear a cell of any text based on the format of the cell (without formula or vba if possible)?

I'm working with numerous documents that have conditional formatting which turn a cell black if a certain value in the row is contains a specific text. The specific text varies a very often and will differ per document. When I try to write something in the black cell, it will automatically decline anything, but when I copy paste something on there it still enters the value. Because I have to copy big sets of data into these documents, I sometimes end up with values in these black cells, which can cause problems later on.
What I was wondering is if there is a way to delete any text in the cells that have the specific formatting (aka they are black) with help of the Find and Replace function or something similar.
Because I have to do it in seperate documents that I get from other people, I don't think using a formula or vba would be too practical, as I would need to manually copy it each time. But feel free to prove me wrong.
EDIT:
Hopefully this will illustrate more what my problem is.
The Background of these cells are still considered to be 'No Fill'
The conditional formatting is what causes the color
Let's assume the formatting you are trying to empty content from is yellow background cells
See image below:
Press Ctrl+H for Replace Option
Press Format Button to select the required format (yellow background)
Press Replace All
Final Result:

Conditional formatting multiple rules to single cell

I have used one formula to change the font colour if a cell contains the text "complete" & another formula to add a light blue fill to the entire row if the word "odd" appears in a cell which is in a different column to the first formula.
The conditions seem to clash & although I have changed and played with the order of the conditions & checked there is no conflict in the fill/background or the font colour, even when changing the font colour manually again the fill from the second formula returns the font the cell to black although it is set to automatic in the conditional formatting rule with the fill ?
I wonder where i am going wrong as everything suggests the two conditions should work fine together though when the fill is applied the font goes back to black when it should be green ?
Have you any suggestions ?
I found the issue, I needed to press clear on the font section of the formatting on the fill condition and then clear on the fill. Basically as a rule I press clear on anything not required in that condition and this seems to avoid the conflict and run upto 6 rules on the same cell with no problems!
You can combine multiple conditional formats overlapping cells/rows. (Excel's just a little picky that you do it just right!)
Always use New Rule as opposed to using the built-in rules.
Choose Use a formula to determine which cells to format.
For your example question, I populated the cells as shown above. Select cell B4 and set the conditional formatting as above =($B4="complete") . Note that I removed a $ (dynamic vs absolute cell reference) that was automatically filled in, so that I can fill the formatting's formula down.
Highlight entire Row 4 and set the conditional formatting as below. Again, note the modified $.
When it's working properly, copy entire Row 4, select the rows to which the formatting should be applied, and Paste Formatting.
[
Obviously the steps will vary for you depending on your data and what's in the neighboring cells whose formats you may or may not want affected by the formatting and copy/pasting.
Let me know if that works for you.
From my experience with conditional formatting, I believe that it applies a format to the entire cell rather than individually modifying fill or font colour, so formats will not combine. I had a similar situation and solved it by creating an additional rule. In your case, one that applies your desired font colour and background fill to the 'complete' cell if the same row also contains 'odd' using the AND() function.

Calculate row count when icons are used

I have icon sets (Tick and close) used in excel rows. I need to calculate the count of "Ticks" in one cell and "close" in another cell. Can you please help me how to do that ?
For cells which has text i am using =CountIF(A8:A10):"Text" formula. but for icons im not sure how to do that.
If you just want to use Excel cells only you will need to add another 'helper' column, which could be then hidden, that contains the conditional formula and then use count on that.
Alternatively you could open the Visual Basic editor and insert a module, using this tutorial on conditional formatting
I think it can not be done using just functions. If you really need to see those icons for example and count them I would use something like 1 and 0 for counting, where 1 is tick and 0 close. If it bothers you, that there are 1 and 0 in cells then change font color to white, for example, then you wont see them, and to get those ticks and close icons use conditional formatting. Conditional formatting allows you to make icons, background color etc. Here is little documentation about conditional formatting. And to count use just =COUNTIF(A8:A10,"1") . That would be how I would do that, but I don't know what you are trying to achieve, hope this was useful.

Use different fonts in same Excel cell?

Is there any way to change the color and/or font of specific text within an excel cell? That is, I'd like one part of the cell's displayed value to be red and another part of the same cell's displayed value to be blue (as an example). Since the displayed values are being calculated as formulas, I'd need some sort of formatting formula that would apply only the stuff inside the formula. I can't seem to find anything in the text.
If you want to do this based on a formula, you will have to write some VBA. See this example
No problem. Edit the value in the formula toolbar.
Take a look at Conditional Formatting in excel.

Conditional Formatting for background color and text based another cell value

I want to be able to test the value in cell $A$3 and determine if it has the text "YES" entered. IF $A$3 is "YES" then the cell $D$3 background should be set to a color and the text for cell $D$3 should say "NA".
I've tried using the following for Microsoft Excel 2003, but does not work. Any guidance would be appreciated. Thank you, Von
=IF($A$3="YES", "NA","")
Additionally, I have the background color set to light Grey when true.
The background changes color when cell $A$3 is "YES", but the text of "NA" is not visible.
The syntax as given works for me in Excel 2003 SP2.
The coloring is done using Format -> Conditional Formatting. When you've got your conditions set up, select the 'Format...' button for each and set the format values the way you want using the dialog. There is a limit of three alternate formats that can be applied to a given cell this way.
I know it sounds silly, but did you set both the text color and background color to light gray?
If you used the function in that manner (the correct one), and the background color is changing as expected, then there has to be something else causing this problem.
In your conditional format, make sure to specify the color of the text as well as the background.

Resources