Excel Conditional Formatting Probsss - excel

I am using conditional formatting in Excel to compare two sets of data (set 1 in column A and set 2 in column D). The conditonal formatting is in column F so if column A=D then column F will turn green and if A /= D then column F will turn red.
The problem is when I delete the first cells in A and D and shift all the cells below up, the whole conditional formatting gets erased. Is there a way to keep that conditonal formatting permanent?
[Im having trouble uploading pics for some reason...if I could, I would include a pic so it's easier to understand what's goin on]

This is a general feature of Excel, not just of conditional formatting. In short, Excel tracks each cell as a unique object, and if it gets moved around (like a row is deleted), then it automatically shifts the reference to that object to refer to its new location.
Hypothetical Example
Consider a formula in cell F5, which says '=A5+D5'. If you rightclick on A3, delete that cell and shift cells up, the formula in F5 will now read '=A4+D5', because the old reference to A5 has now shifted upwards by 1.
You can theoretically solve this by using the INDIRECT function. In the example above, let's say you wanted to delete A3, and then you wanted the cell in F5 to still read '=A5+D5', even though the old A5 had shifted up. You could do this with the following formula:
=INDIRECT("A5")+D5
Because you are indirectly referring to A5 by explicitly writing it out as a text string, it won't move around when rows and columns change. Be warned that this is often counter intuitive. If you insert a new row above row 2, for example, your formula would now read:
=INDIRECT("A5")+D6
Note that D6 automatically shifted, but INDIRECT("A5") did not. This is likely not the desired result. However, if we assume that you will often be deleting (and shifting up) cells in column A, but you want all other worksheet changes to be incorporated, we can do what you want. Again ignoring your specific question for now, consider the above example. How can we change it so that when a whole new row is added, the formula ultimately becomes A6+D6? But at the same time, when A3 is deleted, have the formula now read A5+D5? In short, we do this by referencing the row that D5 is on, as follows:
=INDIRECT("A"&ROW(D5))+D5
Now, if a whole row is added, both instances of D5 in the above formula become D6. But if A3 is deleted, the "A" remains "A", and the D5 instances remain D5.
Actual Solution for your case
In your conditional formatting therefore, the formula would be as follows [Applied to all of column F, or however much of column F you want, starting with F1] [two rules one where A<>D and one where A=D; or, make formatting GREEN by default and have RED only apply where A<>D]:
=INDIRECT("A"&ROW(D1))<>D1

The cause of this problem is likely that the cells you deleted were referred to in the conditional formatting syntax. For instance, if you have a conditional formatting, applied to cells F1:F5 with the formula =$A1=$D1, and then delete cells A1:A3 and D1:D3 (shifting cells up), you will notice that the conditional statement is now only applied to cells F3:F5. Excel tries to update these references for you, but occasionally that isn't what is desired.
Using a formula that doesn't directly refer to the cells will fix this. For instance:
=OFFSET($F1,0,-5)=OFFSET($F1,0,-2)
and
=OFFSET($F1,0,-5)<>OFFSET($F1,0,-2)
Now, when you delete any cells in columns A or D, the conditional formatting will still be applied to all rows.

Related

LibreOffice highlight cells if they are the same as a specific range

Master and Step Chart
Hello, I'm using A4-E4 as a "Master" code, and incrementally using A5-A8 to replace A4, B5-B8 to replace B4, etc etc first replacing one number of the "master", then two different numbers, etc until I have basically every combination. At some point the same number as the "master" is going to be generated. I have the numbers separated into groups of 16 on individually sheets for a total of 64 sheets. Obviously at some point the same number "43254" is going to generate on one of the sheets. Is there a way to search/highlight that number automatically upon generation? I've found that I can do conditional formatting to search for a specific cell, but not a range of cells. Like compare "A4-E4" to every set of five adjacent numbers in all the sheets, then highlight it. I have no idea if this is possible, but I'd appreciate it.
Select cells A4 through E4 and go to Format -> Conditional Formatting -> Manage. Apply style Good if Formula is:
CONCATENATE($A4;$B4;$C4;$D4;$E4)="43254"
So 43254 matches.
And 43253 does not match.
This is more complex than first appears. The following explanation may be difficult to understand if you do not have much experience with conditional formatting.
The formula gets evaluated 5 times, once for each of the cells.
Normally, rather than always indicating cell A4, Calc would interpret A4 as the currently evaluated cell (because we selected cells starting from A4). And B4 would indicate the cell to the right of the current cell that is evaulated. So for example, if such a conditional formatting formula were filled to cell D7, then A4 would actually indicate cell D7, and B4 would indicate cell E7.
However, our formula uses $A4 instead. The $ tells Calc that we always want column A even if the formatting is for column B or C et cetera.
One outcome of this is that the formula can be filled down or up but not left or right. If it is filled down one row for example, $A4 refers to column A but the current row, which would be cell A5.

Transferring certain cells from one sheet to another in excel despite column/row insertion/extraction

The title pretty much says it. I need to transfer certain cells from one cell to another without the coordinates of the cells changing after an insert operation.
In ex., I want the value of cell B3 of Sheet1 to transfer to cell A2 of Sheet2. If I insert a column on the left of B3, the previous B3 will become C3 and you now have a new B3 in which you can add a new value. I want my A2 to still receive the value of B3, but the new B3, not the old B3 with is now C3.
If I go with +Sheet1!B3, after the insertion of the column it will become +Sheet1!C3. I want it to remain to +Sheet1!B3.
I tried with $, +Sheet1!$B$3, but it still changes.
You can use the indirect function in excel.
+INDIRECT("Sheet1!B3")
With the caveat that you never change the location of column A you could do the following:
=INDEX(Sheet1!$A:$$ZZ,ROW(B3),2)
Caveat: as set up will only work for cells between and including columns A and ZZ. the ZZ reference will increase as columns get added. If you have columns outside of ZZ initially, then you will have to adjust the final column reference to suit your needs.
INDEX gave me some errors in the function (probably on my end), but I managed to solve it using INDIRECT.
Ty for the feedback, #AlexCollins #ForwardEd

Conditional Formatting for a row when there is a text disagreement between two cells

I'm working on a conditional formatting issue. I would like the whole row to highlight if the text in the same row in columns B and C disagree. So far, I've been able to write conditional formatting rules that leave the cell un-touched if there is no data and if there is a data entry that disagrees with the text in Column B, but I can't seem to get the formula to apply to the full row.
Here is what I currently have:screenshot of the document with conditional formatting rules visible
I'm working on Excel 2010. Maybe there is a way to use a logic formula?
I look forward to hearing suggestions!
You can do this with a formula. Highlight the range you would like to format, create a new conditional format, select "Use a formula..." and enter the formula as it would apply to the first cell or in this case row.
In my case, I chose the first 6 rows: $1:$6 as my range. So in this case, I would enter the formula as if I were only entering it for my first cell. The formula =$B1<>$C1 will check for inequality between B1 and C1 in the first row, B2 and C2 in the second row, and so on.

Conditional formatting: automatically refer to the next cell?

I have a schedule with team member names and the column headers are half hour time intervals. I want to shade the cells of hours each person does not work with gray according to their shift schedule, so that I know not to schedule that person during that hour.
I have created a separate table with each person's shift schedule, and the names appear in the same order as in the schedule.
Is there any way to conditionally format the cells at once? There has to be an easier way then what I am doing now...which is one by one clicking on each person's cell and creating the formatting formula.
I can't copy paste the formatting because the formula still refers to the previous person's shift on the other table. I need it to refer to the next row.
The formula I use for conditional formatting is:
='Job Functions'!$O$5>$C$9
Where Job Functions is the sheet that contains the shifts, O5 is the shift assigned to that employee, and C9 is the column header on the schedule (6:30am). I just clicked on the cell and created a new conditional formatting rule from the excel ribbon on top...no vba.
If there is a VBAsolution to this that'd be great! I'm fairly new to VBA
Conditional formatting works like this
Let's say I have an array of numbers in A2:E5 and a header row in A1:E1. I want to have my array of number be green if the value of the cell is greater than it's column header. That is to say I want to compare A2>A1, B5>B1, D4>D1, etc. this means I want the header row comparison to be constant.
In Excel formulas you use the $ symbol to maintain constant references. Since I want the row to stay constant but I want the column to be relative to the cell in my array of numbers my header reference will be A$1 (column is relative, row is locked).
This is just the formula used to determine if formatting will be applied or not. If it returns true then the conditional formatting is applied, if it returns false then nothing happens.
However, where the formatting is applied is determined by the Applies to reference. In my example below I am applying the formula A$1<A2 to $A$2:$E$5. This means that in the cell A2 the formula A$1<A2 is used to determine if formatting is applied, but in B3 the formula B$1<B3 is applied. This is the same logic as if you were to have dragged the formula itself into these cells.
If instead my Applies to formula were $B$2:$E$5 this means that B2 would be colored green if A$1<A2, and B3 would be colored green if A$1<A3.
So with all that your formula should probably be
='Job Functions'!O5>C$9
drag and drop it down to fill the other cells

Autofill conditional formatting cell references

Excel conditional formatting fill down is working but not recording the correct formula once filled down.
eg. Cells in Column B (eg B6) have a value (active, exit, suspend). The adjacent Column C cell needs to be colored green if the adjacent value in column B shows the entry active. This works fine when using in C6 Use a formula to determine which cells to format, and Format values where this formula is true shows =B6="active" and cell C6 comes up filled with the green color.
Upon fill down from cell C6 the formatting is all displayed correctly for each additional instance of the word active in a column B cell. However when the conditional formatting rule is viewed for a cell such as C7, C8 onwards instead of showing =B7"active" or =B8="active" etc they still all say =B6="active".
Does anyone know why they do not refer to their relative adjacent cell (B7, B8, B9 etc) instead of the original B6? The formula originally was =$B$6="active" and has been edited to remove the absolute reference and replaced with =B6="active" to allow a relative fill down.
Does anyone know why they do not refer to their relative adjacent cell ( B7, B8, B9 etc ) instead of the original B6 ?
Presumably someone in Microsoft does and that is not the answer you seek.
However you acknowledge the formatting is working so it hardly seems to matter.
I can suggest that it is efficient. Conditional Formatting with a formula has three key parts:
Formula
Formatting
Range
Formula
May be complex and lengthy.
Formatting
It is what it has to be. Usually a very simple fill colour but sometimes bold, font, font colour etc.
Range
The 'neglected' one of the three but equally important though simple - just co-ordinates defining one or more rectangles (or a singe cell reference otherwise the top left and bottom right references). An efficient way to define an area that works whether one cell or one million, still just two corners at most.
You have probably noticed that whatever you enter there that is valid, anchors ($ signs) will be added where not already provided. You may also have noticed that Applies to will accept a named range - but Excel then automatically converts this to the cell reference/s.
It might help to consider what you would do if you were in charge of having doors painted yellow at house numbers 1 to 10 on a housing estate (yellow highlighting probably the most common format chosen for Conditional Formatting and a cell being roughly the shape of the surface of one side of a door). Say during the process you were required to extend that to house numbers 11 to 15 also. Would you then produce five additional copies of the painting specification (the formula), it might be several pages long, or would you merely change your instructions to the team doing the work from "do this for houses 1 to 10" to "do this for houses 1 to 15"?
As you copy down the Applies to range adjusts accordingly, the system works. But for each rule there is only one range and that is the case in reverse, for each range thee is only one rule, So no need to express that rule cell by cell, hence perhaps a million times over.

Resources