Excel: How to use conditional format in other cell? - excel

How to use conditional format in cell A1 if B1 = "foo".
Example, B1 = IF("FOO";;), A1 is yellow color.
Is Excel 2007.

Use the following coniditona format formula for cell A1
=($B$1="Foo")
Note That if you want to apply this to the entire column A then make the following two adjustments.
1 - change the formula to remove the $ from the row in the formula so that it reads =($B1="Foo")
2 - ensure that the formatting is applied to the entire column

Related

how to write an if statement code to compare two cell's value in one sheet to another cell in another sheet

i have two columns (Start Date, End Date) and i want a code that changes the color of both their cells to red if the start date and end date contained any date located in another sheet
I tried using conditional formatting using this rule: =AND(C2<=Holidays!$A$2:$A$15,D2>=Holidays!$A$2:$A$15)
Tested out the below formula for myself and think it should work! Effectively rather than a simple AND statement, since we're comparing against an array of values rather than single cells, we need to use some handy array formulas. This post gives a good breakdown of what's going on under the hood: https://exceljet.net/formula/index-and-match-with-multiple-criteria
Apply this formula in conditional formatting, assuming the range you're formatting starts at C2.
=SUM((Holidays!$A$2:$A$15>$C2)*(Holidays!$A$2:$A$15<$D2)) > 0
Also, wanted to call out the absolute references specified for columns. I've specified **$**C2 and **$**D2 in my formula, which means that no matter which cell in your conditional formatted range it'll evaluate off the values in column C and D. In your current formula, cell C2, would evaluate on C2 and D2, but cell D2 would then evaluate off D2 and E2. This'd be why when you tried the manual formatting only the start date cells (column C) were formatting correctly.
Hope this helps!
Update::
If you had a table format like in the attached screenshot, you would apply the conditional formatting formula:
=SUM((Holidays!$A$2:$A$15>$C2)*(Holidays!$A$2:$A$15< $D2)) > 0
To cell range $C$2 : $D$3
If you're changing the cell range (say you wanted to apply to $C$10 : $D$14), you'd just change the $C2 and $D2 in the formula --> $C10 and $D10.

How to enable conditional formatting so that a cell becomes red whenever today's date becomes previous cell's date + work days?

Cell A1 (till A10) contains random date. I want B2 (till B10) to become red on the 3rd work day after A1. Also, if B is empty or NA then dont color B.
For example: if A1 = 18Oct, then B1 should become red on 23Oct. If A2 = 21Oct, then B2 should become red on 24Oct.
What code should I put in conditional formatting?
Highlight the relevant range in Column B, which is B1:B4 in the above example, enter the following formula as the formatting rule for conditional formatting:
=NETWORKDAYS($A1,$B1)=4

Excel - Conditional Formatting: If the cell above is different, change fill color

So the problem I have is trying to change the fill color using conditional formatting in excel. This is basically what I want to do:
First I have a column, something like this:
1
1
1
2
2
3
4
4
4
Now I want to use conditional formatting to check if cell A2=A1, if it is to have fill color #1, and so on. Once it gets to cell A4 and it checks that A4=A3, if it does not match I want it to switch the fill to fill color #2, and it continues to check. Basically every time the cell does not match the value of the cell above, to switch to a different fill color.
I tried using the OFFSET function to check if that value was the same as the cell above, that worked but once I added the function to conditional formatting it went all funky and did not change colors.
Using your sample data, say you put them into cell A1 to A9, highlight cell A2:A9 only, and set up the conditional formatting as shown below.
For duplicated value you will use =A2=A1
For different value you will use =A2<>A1
select a cell outside of your table (let's say it's Z1) and fill it with the value: AB
cell B1 value: A
in all cells from B2 downwards: =IF(A2=A1,B1,SUBSTITUTE($Z$1,B1,""))
it means that if A2<>A1, B2="B"; if A3=A2, B3=B2="B"
fill all cells on column A with the color you want for "cluster" B: let's say it's blue
add "$B1="A" in conditional formatting, filling = red

Excel formula for linked value as percentage

Excel converts a percentage to a fraction when pasted as a link, e.g. 50% in referenced cell B2 in Sheet1 is shown as 0.5 in linked cell X10 in Sheet2.
However, instead of a percentage, some linked cells in Sheet1 contain text or are empty (there are many workbooks - Sheet1 is a questionnaire).
So a formula like =((('Sheet1'!B2)*100)& "%") & "" does not work for all cells, because the value might be text (gives a #VALUE error), and also & "" does not work for empty cells in this formula.
I need a formula to convert the linked fractions in Sheete to percentages in Sheet2. I have tried with ISNUMBER without success and also do not know how ISNUMBER could be made to work with a text value (yet another nested IF formula, I guess).
Can anyone point to a solution?
Thanks!
CJ
A simple conditional formatting example below:
Step 1
Rightclick cell A2 > Format cells > Number > Custom > 0;-0;;#
Type a 0 in cell B2 to test if zeros are no longer displayed
Step 2
Type =B2 in cell A2
Type Test in cell B2 to check link and leave it
Step 3
Select cell A2 > Start > Conditional Formatting > New Rule > Use a Formula > =ISNUMBER(B2)
Format > Number > Percentage
Type 0,8 in cell B2 to test.
The conditional formatting rule will overwrite your custom formatting rule when the rule applies e.g. when cell B2 is a number!
I'm not sure if it is worth putting as an answer, but I don't see a problem with
=IF(ISNUMBER(Sheet1!B1),Sheet1!B1,"")
and format the range in Sheet2 starting with B1 as percentage with required number of decimal places.
For conditional formatting, I could only get it to work with
=NOT(ISNUMBER(Sheet1!B1))
and a format of ;;;
EDIT
If you want the text to appear, first formula should be
=IF(Sheet1!B1="","",Sheet1!B1)
or use ;;;# in above formatting rule.

Conditionally format one cell based on values in a column

The user enters a date/time into cell B2. If this matches one of the values in column L I would like to format cell B2 as red, else format cell B2 as green.
Any idea how to do this?
Please format B2 green with standard fill, then apply the following Use a formula to determine which cells to format, Format values where this formula is true:
=match(B2,L:L,0)>0
with formatting (red) to suit and Applies to B2.
Assuming you are using Excel 2007 onwards:
Set cell shading for B2 = Green
Select Cell B2 and select the Conditional Formatting > New Rule menu item
Use a formula to determine which cells to format
In the formula bar, put in =ISNUMBER(MATCH(B2,$L$6:$L$100,0))
For format, change shading to Red
Obviously change the $L$6:$L$100 to suit you, but that should do it...
What about breaking this up into two steps.
Try putting a simple formula in Cell B1:
=ISNUMBER(MATCH(B2, L:L, 0))
This will return a TRUE if there's a match and a FALSE if there is not a match. Then make two conditional rules based on Cell B1.

Resources