Conditional Formatting Based on Two Cells - excel

I have added some VBA coding to a document using Wingdings 2 P to create ticks. I now want to add some conditional formatting so that if two cells have P (the tick symbol) then they turn a colour. I can get it working in one cell but when I try to copy the formula it won't work. The formula I have put in is:
=AND(M6="P", N6="P")
Can anyone help?

I think you may want a CF formula of the kind:
=AND($M6="P",$N6="P")
but it does somewhat depend upon what you would like formatted subject to the condition/s.

Related

how do I compare each row of two different columns and highlight the highest value (not formula) in each row?

I have two columns to compare. All cell values come from the ROUNDUP function. =ROUNDUP(C6/D12,0) etc.
I want the larger, or equal, of the two in each row to be green and the smaller red. Using the formula, it does not work as expected. If I do the same with numbers typed, not the formula, it works. It appears the formatting applies to the formula and not the value.
That is the first half of the problem. I also want to autofill/paint the conditional formatting to numerous cells, but it always compares to the top left cell, rather than the two cells on the same row.
If I use the color scales formatting it works, but I do not want the scales, just red/green.
It seems hard to believe that what I want to do is not possible. Can someone please help me with this. Thanks in advance.
In conditional formatting, under 'use a formula to determine which cells to format', you need to enter
=A2=MAX($A2,$B2)
to highlight the larger cell and (as a separate rule)
=A2=MIN($A2,$B2)
to highlight the smaller cell.
Note that in the case where both cells have the same value, they will both be either coloured red or green depending on the precedence of the rules. If the 'green' rule comes first,
it will look like this:
Conditional formatting is almost its own little science within Excel. It may be more useful to find youtube tutorials on the topic than depend on a text explanation here. But the central theme is this.
You will use location locking (the dollar sign or F4) in front of the letters so that any cell to which the format is applied knows you specifically mean columns E and F, for instance.
Example: Assume your first row goes from A5 to M5, and the condition values are in E5 and F5.
I find it easiest to format one row with the rules I want, test them, and then use the format painter or copy -> paste format along with careful use of $ locking.
Drag over and select the entire row of cells A5:M5
Conditional Formatting -> New Rule -> Use a formula to determine which cells to format
In the formula field enter =$E5>$F5. Excel gets weird and often inserts double quotes. If you save the rule and go back in, it may say ="$E5>$F5" and if so delete the double quotes.
Click Format and create the cell format you want.
With A5:M5 still selected, add another rule and format for ="$E5<$F5"
The $ sign works the same way as it does in a formula. All of the columns get their format based on columns E and F, but all of the rows base their formula on the E and F values in that same row.

Excel - Conditional Formatting not working because cell has an existing formula

My conditional formatting rules I am using to highlight a row with value = 1 dont seem to be working because there is an existing formula in the cell. So I assume excel is seeing the formula but not the actual value and not highlighting it. Is there a way around this? I tried =$A2=VALUE(1) and it highlighted some rows but no the correct one.
You can do this by going to Conditional Formatting -> Rules to Highlight Cells -> Equals. Then, you enter 1 and select the preferred formatting.
I hope that I translated the menu correctly; I use Excel in the German language since it's my mothertongue.

Excel conditional formating - conditional on sum of all previous cells and total sum

I have a question with regards to conditional formatting which I simply can't seem to solve.
The aim is to format the background color for the left-most cells that are blank up until a cell contains a value - and after this there should be no more formatting in this row. You can see an image of the result I'm hoping for beneath:
So far I've managed to create the conditional formatting of the blank rows, but sadly haven't managed to create the "single-cell" formatting (in yellow) conditional of the sum of all the first cells being = 0.
I've created a formula which actually succeeds in calculating the sum of the previous cells, but this formula includes INDIRECT() which it seems that conditional formatting doesn't allow. At least I'm getting an error starting with the follow (translating the error from Danish to English might not be intuitive):
You cannot use reference operators such as.....
The formula I'm trying is the following:
=AND(SUM(A2:INDIRECT(IF(COLUMN(A2)>=27;CHAR((64-26)+COLUMN(A2))&CHAR((64-26)+COLUMN(A2))&ROW(A2);CHAR((64)+COLUMN(A2))&ROW(A2))))>0;$K2>0)
Where $K2 is the sum of the row.
Is there a way to SUM a range of cells by doing something similar to this:
=SUM(B2:CHAR((64)+COLUMN())&ROW();"")) to dynamically SUM the range from B2 to the current cell? The problem in this case is whether the part CHAR((64)+COLUMN())&ROW();"") can be converted into a legible cell such as B4 to make it work inside the =SUM() formula?
Sadly the =ADDRESS() formula cannot be used (as far as I know) as this will trigger the same error in conditional formatting as well.
For now I would like this to work with the regular Excel conditional formatting, but if anyone have a simple VBA this would also have interest - however, I would by far prefer the regular solution.
The question:
Is there a way to create a formula that doesn't trigger this error - maybe by refrasing the formula or doing something completely else?
It seems to me that this could be handled with a much simpler CFR formula like,
=and(not(sum($a2:a2)), $k2)
Am I missing something?

Excel Formula If Cell Contains String

I'm currently working in excel, and I'm trying to figure out a way to find if multiple cells contain the string value of another cell, and if it does highlight the cell where the row and column meet up. I created an example of what I want, only it will be on a much larger scale.
I've tried using: =ISNUMBER(SEARCH(substring,text)) but I'm not quite sure how to use it the way I want to.
Any help will be appreciated!
Your approach is correct, we can use the fact that conditional formatting is applied like dragging a formula, adapting relative references.
Create a conditional formatting formula rule:
=ISNUMBER(SEARCH(B$1,$A2))
Applied to B2:D7
Your formula will work nicely; what you'll want to do is put that formula into all the cells you want to highlight, so you get FALSE and TRUE in every cell.
You'll then use two Conditional Formatting rules. The first will look for Cell Value = TRUE, and will set cell background and font colour to yellow. The second will look for Cell Value = FALSE, and will set cell background to No Colour and Font to White.
This will reproduce the result you're looking for.
Edited to add:
It is possible to do this using just Conditional Formatting too, but it's a little more fiddly. If you want to try it, you can do this:
Highlight your range, and take note of which cell is Active - that's the cell within your highlighted range that is still white. It's also the one whose address is shown in the Name box in the upper left. For the sake of this answer, we'll assume that's B2
Create a new Conditional Formatting rule. Choose "Use a formula to determine which cells to format".
Use the formula =ISNUMBER(SEARCH(B$1,$A2). Set the format to colour just the cell background.
Note where the $ appears in the formula above - you want to leave the row number anchored in the first part, and the column letter anchored in the second part.
This takes advantage of the fact that Conditional Formatting is able to use absolute, relative, and mixed references to find which cells to format. It's also a tidier solution, but it can be harder to maintain if the sheet is ever repurposed or modified.

Formatting Selected Columns Depending Cell Value Is Odd Or Even

I have a sheet with several columns. Column A consists of numbers. Depending if the cell value in column A is even (or odd) I want to highlight several cells in that row, but not the entire row.
So far using conditionally formatting I have been able to add a formatting rule for each column I want to have highlighted. So for example if I want columns A, B and E highlighted I use three rules:
Formula: =ISEVEN(A1) - Highlight Format - Sheet!$A$1:$A100
Formula: =ISEVEN(A1) - Highlight Format - Sheet!$B$1:$B100
Formula: =ISEVEN(A1) - Highlight Format - Sheet!$E$1:$E100
...and etc for all additional columns.
But this is very cumbersome, I don't know how to make a rule to cover it all in once or even if it is possible. I'm guessing VBA might be the solution, but I'm kinda a rookie there.
Any clues on how to attack this?
You should just fix your reference column in the formula for that (A becomes $A in this case). The ranges it applies for then can be all put in the same rule as well:
Formula: =ISEVEN($A1) - Highlight Format - Sheet!$A$1:$B100;Sheet!$E$1:$E100
So no VBA required!
:) You do not need to sweat so much at all. I am not sure what your Highlight Format for. You can add the even, odd into the conditional formatting window/wizard text boxes and then choose the formatting colour accordingly.
Try this out:
For even:
=MOD(A1,2)=0
For odd:
=MOD(A1,2)>0
Check the following article for better help on Excel conditional formatting
Another article for 10 cools way to use Excel conditional formatting

Resources