Formatting Selected Columns Depending Cell Value Is Odd Or Even - excel

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

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?

Apply Conditional Formatting to Cell on Left

I have a spreadsheet with 15,000 rows and 30 columns, and have applied a conditional formatting to column X to color it when it contains a certain text. This works as expected; however, I want to apply this same formatting to the cell immediately to the left (column W) as well. Is this possible?
Based upon what you say below, this is what I tried:
The formatting is not working. Is the lookup formula not correct?
Note: Since I never know how many rows I may have at any time, I am trying to apply the formatting to the entire column instead of a specified range of cells.
EDIT:
The $X1 trick works!
You are the BEST! Many thanks to all of you!
Of course!
Your conditional format range will look something like this:
Just change the (highlighted) range to $E$1:$F7 to apply the formatting to both columns. This doesn't affect your condition at all.
As Jeeped points out, any time you change the "Applies To", you should double check the Formula and make sure it didn't change. Using anchors ($) in your range helps greatly with this. Note how in my formula, I have =Left($F1,3)... The F is anchored. I'm pretty sure if that was just Left(F1,3), and I adjust the "Applies To" range to $E$1:$F$7, the formula would "update" itself to be =Left(E1,3)... which isn't what I wanted.

Conditional Formatting Based on Two Cells

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.

Resources