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

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.

Related

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

Conditional formatting for a column based on the value of header

I have several columns where the data from rows 7 onwards changes depending on the selection made from a dropdown menu in row 6. Most of these options will result in textual or number based values appearing, but two of them would need to be formatted as currency.
Essentially what I want is a conditional formatting formula that says; if row six in any column has a value of “Implied Unit Rate” or “Annual budget”, format rows 7 and onwards in that column as currency.
I can get this to work by creating two separate conditional formatting formulas and applying them both to the whole area, but it seems like there should be a way to do it in a single formula.
My current formulas, applied as two separate rules:
=INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget"
=INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate"
How I think it should work when applied as one rule:
=OR(INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget",
INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate")
When I enter the combined formula in a regular cell within the worksheet, it does return true as expected, but does nothing when I apply it as a conditional formatting rule. Any ideas? Thanks in advance!
Now I may be mis interpreting what Scott is saying, so I am going to say this in my own words.
Your condition check on the cell address in question is a little "verbose". In order to apply your conditional formatting, select the range you want to apply your condition formatting to first. Lets arbitrarily say select range A7 to D42. After selecting the appropriate range, ensure cell A7 is the active cell of the selected range. This usually means there is a border around A7 to D42 and all cells but A7 have been slightly greyed to indicate that they have been selected, and A7 will have a brighter background to indicate that it is the active cell. With all that still in effect, select your conditional formatting.
In conditional formatting choose formula as the option (last one at the bottom) to control how your formatting will be applied. In the region where you can enter your formula, enter the following:
=OR(A$6="Annual Budget", A$6="Implied Unit Rate")
The $ will keep the row and column reference from changing as it is applied to each cell in the range. It will always be checking row 6 of what ever column the cell is in. The column A reference is relative to the active cell.

Excel Conditional Formatting Probsss

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.

Highlighting rows based upon two adjacent cells being different but specific numbers

I am trying to put together a conditional formula for an Excel spreadsheet. What I need is for the row to highlight when cells A2 and B2 are two different, but specific numbers. For example, I want the second row highlighted when the value in A2 is exactly 12345 and when the adjacent value in B2 is exactly 67890. I do not want the row highlighted if the value in A2 is anything other than 12345 and the value in B2 is anything other than 67890. There are about 3,500 rows of numbers, so I am trying to speed up the process. I will eventually have to do the opposite, and see when the value in A2 is 67890 and when the value in B2 is 12345.
In order to clear up any questions, I am looking at an Excel document tracking phone calls made over a long period of time, and I want to highlight the whole row when two different phone numbers are calling each other among all the other phone calls.
With conditional formatting, you can use formulas. Highlight a row (let's say row 2 to start), and in Conditional Formatting, under "Use a formula...", =and($b2<>$a2,$a2=12345,$b2=67890).
If you apply that to your whole range (a2:b100, let's say), if the cell in A and B are different, and then only if A and B are the numbers you want, will the row be highlighted.
edit: added absolute cell references. Also, see #Grade'Eh'Bacon's comment.

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