Formatting in cell depending on row in Excel - excel

Lets say I have a name in cell A1. I'd like to make that cell green if there is "o" or "x" in any of the cells spanning B1:Z1.
Also, could you do this thing on a larger scale if you have 20 names under column A from A1:A20; so you don't need to format each cell individually?
Here is an example of my naughty and nice list:
A B C D
Name Mon Tue Wed
Mark x x
Donna o x o
Amy x
I tried to do it with conditional formatting on A2
=OR($B$2:$H$2="x";$B$2:$H$2="o")
but in this instance it only works on the first two examples, since the B column has a value in it.
Is it possible to do that on a list of 40 people on a mass scale. to not have to do formatting for each row seperately?
I'm using Excel 2013 if that helps in any way.

Ahh, now that I understand the question, the conditional format option can be applied.
Select cells A2:A20
Go to Conditional Formatting on the Home tab
Click on New Rule... and you will see something like this
Click the "Use a formula" option and enter this in the "Format values where..."
=OR(COUNTIF(A2:H2,"x")>0,COUNTIF(A2:H2,"o")>0)
and then click the Format... button to apply a green fill to the cells.
I'm using COUNTIFs because comparing or testing a range for a specific value needs an array formula which I've never really considered for a conditional format. It may work but I prefer the KISS principle.

I would do what you have (the OR expression,
=OR(NOT(ISBLANK(Table2[#[B]:[D]]))) (as an array, shift-+ctrl+enter)
) and put it in it's own column(E). Then just look at that with a formula in the conditional formatting that looks like:
=E2

for me this formula: =OR(B2:X2="o",B2:X2="x") produces the desired result, and I don't experience the strage problem "when B is empty" as you describe.
Not sure about the difference between ; and , separators - it has something to do with regional settings (some info here)

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.

Using IF and conditional formatting

I'm trying to have a cell becoming highlighted if it satisfies two criteria.
I would like the cells below each Staff column to be purple if its both the same as the version# and contains *.
I've managed to highlight cells containing the * by using "highlight if cells contain" ~* but I can't get it to do both.
I've tried
=AND(L2=$J2,"~*")
=AND($J2,"~*")
=IF(AND(L2=$J2,"~*"))
(Version# is column J, Staff 1 is column L)
Answer by BigBen
If the Staff # contains an asterisk, will it always immediately follow the version #? If so you could just do
=L2=$J2&"*"
Seeing what I think you want, the main issue is the asterisk. When you enter a number in a cell and also enter a non-numerical character the cell automatically becomes formatted as TEXT. It is possible to extract the numerical value with a formula, but handling what you want is much easier if you separate the number from the asterisk. In my included example (You should be able to open it in a new tab on your browser) created narrow columns after each 'staff#' column to accept the asterisk entry.
This done, enter the three conditional formats as shown (in C2 in the example). You then copy the C2 cell into each of the cells under the Staff# columns. That produced the results shown which I think is what you want. Changing entries will produce the proper formatting results for that cell.

Excel - Highlight cell which is closer and smaller to a specific value

I would like to highlight a cell which is the closest the a specific value but still lower (below) or equal according to a formula.
For instance, if I have 14 in B4, I would like the cell 13 (or 14) highlighted but not 15 in the range.
The value I need to look for would be in B4 and the range that I must apply the highlight formula to would be L1:L371.
So far, the best result I was able to achieve was with (from what I was able to find using Google or Stackoverflow already existing content):
=SMALL($L1:$L317,COUNTIF($L1:$L371,"<="&$B$4))
Although, not only it selects the value I am looking for, it also selects all the values below.
May someone provide me some help so I can achieve the expected result please?
Thank you for your time and help, it is greatly appreciated.
Based on your description, it seems like you need to find the maximum value of a range (L1:L137) that is less than or equal to an input variable (B4) and highlight that value in the search range. Depending on what version of Excel you have, here's what you need to do:
For Excel 2019 or Excel 365
You can use the MAXIFS function. You would actually put that function in a conditional formatting rule, but more on that in just a second. As a test, put the following code in cell B5:
=MAXIFS($L$1:$L$137,$L$1:$L$137,"<="&$B$4)
The first argument is your "MAX_RANGE", or the range that contains the values you want to find the max of. It is also our "CRITERIA_RANGE", the second argument. The third argument is the criteria itself, which is that the search range must be less than or equal to the value in cell B4. Essentially, we are going through the list and creating a subset of numbers that are less than or equal to our search value, and discarding the rest. I assume you are aware of relative vs. absolute referencing, since you used the "$" anchor in your referenced code. If not, here's a description of the difference.
Now, the result of that formula should be the highest number in the list less than or equal to the search value, but that doesn't highlight it for us in our list. To do this we need conditional formatting. To do this, highlight your data range (L1:L137) and go to the conditional formatting drop down on the home tab of the menu ribbon. Choose "New Rule". On the dialog that pops up, choose, "Use a formula to determine which cells to format". In the formula input box, enter:
=L1=MAXIFS($L$1:$L$137,$L$1:$L$137,"<="&$B$4)
This will compare whether the value in the cell being evaluated (L1, for instance) is equal to the result of that formula we talked about above. Since L1 is only relatively referenced, this formula will work for every cell in the data range.
Now, before you hit "OK" on the dialog, select the Format button. This will allow you to adjust your highlighting and formatting as you desire. Click "OK" on the formatting dialog, then "OK" on the Conditional Formatting Rule dialog. This should now highlight any data cell that is equal specifically to the result of our formula, and not everything that's less than our value.
For Earlier Versions of Excel
The concept is the same in earlier versions of Excel, but unfortunately, the MAXIFS function is not present in these versions. Instead, we must use an array formula. Array formulas are a whole other can of worms, but ExcelJet is an excellent resource. In fact, they talk about this very issue, here.
Unfortunately, we can't put the array formula in the conditional formatting formula like we did above, so we'll need to put this formula on a cell in the worksheet, then the conditional formula should reference that new cell. So in cell B5, if you put:
=MAX(IF(L1:L137=B4,L1:L137)
And then, instead of pressing Enter, you must press Ctl + Shift + Enter
This keyboard combination will tell Excel that you are trying to enter an array formula. If you don't press these keys, then the formula will error. Once you have entered the array formula, if you put your cursor in cell B5, you will see the formula bar at the top has added curly braces ({ , }) around the formula to look like
{=MAX(IF(L1:L137=B4,L1:L137)}
This leads to the same result as above, but is just achieved slightly differently. Now, following the same process described above for conditional formatting, you will simply set the formula to:
=L1=$B$5
And that should be it! Hope this helps!

Google spreadsheet conditional formatting between two dates and another value

I'm trying to conditionally format each of the rooms so that they will be Red normally but green if the room will be available for a particular day. The date of interest will be changed on the top left of the "Office Rooms" Tab. The values in the "Form Responses" Tab populate from a google form.
Values to consider:
Room numbers on the "Form Responses" Tab
Date range on the "Form Responses" tab
Date at the top of the "Office Rooms" Tab
I've tried IF statements and I know about using INDIRECT. But I think this may just be too complicated for the normal "Conditional Formatting" route. I may need to use Apps Script but I'm not too familiar with that yet.
I've posted a link to a copy of what I'm working on below. Thank you in advance for any help you can throw my way!
Link to Google Sheet
This can be done with conditional formatting alone, using the following custom formula.
=isna(filter(indirect("'Form Responses'!B:D"), indirect("'Form Responses'!B:B") = B4, indirect("'Form Responses'!C:C") <= $C$2, indirect("'Form Responses'!D:D") >= $C$2))
As written, this can be applied to B4 and any range that has B4 as upper left corner. For other ranges, change B4 to its upper left corner.
Explanation: the filter command filters the indicated range according to criteria: B matches current cell, C and D are around the date stated in C2 of current sheet. If there is no match, then the result is #N/A and isna evaluates to True, triggering formatting (which would be red).
The formula would be a lot shorter if the data was on the same sheet. As is, one has to refer to 'Form Responses'!B:B and such, which within a conditional formatting rule requires indirect.

How to apply conditional formatting based on the result of a cell's formula

I am stumped at what should be a simple matter. I have this formula in a column of cells:
=IF(ISBLANK(BG7),"",IF(BG7>=70,"OverBought",IF(BG7<=30,"Oversold","Neutral")))
The formula works and the cell shows the correct word.
I would like to apply conditional formatting to the result of the formula
green for Oversold
red for OverBought
yellow for Neutral
I have tried every variation I can think of for "Value of Cell" with and without quotes, "Enter a Formula" etc and no dice. What am I missing?
I used your formula, selected the cells, and used the menu "Conditional Format", then first option (something like "highlight cells"), then forth option ("equal"), then typed Oversold with no quotes and anything else, then selected a format option.
Then i repeated the same steps for the other values (Neutral, OverBought), selecting different format options.
It worked.
This set of rules work for me:
Go to Conditional Formatting > New Rule > Format only cells that contain > Cell value Equal to Whatever.
Admittedly I use Excel 2013, not 2010 as in your case, but I'd be very surprised if there is much difference for conditional formatting rules like these.

Resources