I tried by selecting range then conditional formatting then cell value equal to then =large($C:$E,1) THEN fill golden color for 1st highest value. This formula applies to entire columns. I need help with applying formula within range i.e from 31 t0 41. I have values in column C i.e c31:c41 and column E i.e E31:E41 in percentage . I want golden color for 1st ,silver for 2nd and yellow for 3rd highest of two columns. Column D has names so column D can not be selected.
SAMPLE EXCEL FILE
sample data
C D E
2.54% vinu 5.69%
119.90% anand 157.34%
49.32% tanaji 7.39%
82.28% umesh 121.21%
-21.66% chandu 94.10%
-60.45% rajan -25.71%
-20.12% mule 37.02%
-16.05% jafgtap 31.085%
-3.50% kunal 282.62%
-3.27% ramesh 14.58%
-8.12% rajesh 5.86%
Select the cells C31:C41 and insert a new formatting rule using a formula. This is the formula if your data starts in row 31 and the active cell is C31.
=C31=LARGE($C$31:$E$41,1)
Note the placement of the $ signs. It is important. Format this to be gold, then
create two more rules with 2 and 3 as the last parameter for silver and bronze.
If the currently selected cell is on a different row than row 31, use the respective row number. My screenshot starts with row 1.
Select the cells in the worksheet, click the Format Painter on the Home ribbon and select cell E1 to apply the same rule to the cells in column E. In the screenshot I changed your sample numbers so column C has the third highest value.
Edit after comment:
If you explicitly want to exclude the values in column D, you can perform the Large() function on a limited list of ranges like this:
=LARGE(($C$31:$C$41,$E$31:$E$41),1)
Unfortunately, Conditional Formatting rules will not accept formulas with that level of complexity. The solution is to create three defined names with these formulas:
Gold =LARGE((Sheet11!$C$31:$C$41,Sheet11!$E$31:$E$41),1)
Silver =LARGE((Sheet11!$C$31:$C$41,Sheet11!$E$31:$E$41),2)
Bronze =LARGE((Sheet11!$C$31:$C$41,Sheet11!$E$31:$E$41),3)
Then you can use three conditional formatting rules that compare the value in the range with the values of the defined names Gold, Silver and Bronze
This post has been quiet for a while, but maybe you can help me.
I have a large file with criteria across the top, labels on the left and scores in the middle. I've correctly modified the formula above for row based eval.
=B2=LARGE($B2:$X2,1) and =B2=LARGE($B2:$X2,2) and =B2=LARGE($B2:$X2,3)
I've noticed that if there are joint second largest values, then the third one doesn't work, and but the 4th one does work. It's not a major pain.
What I want to do now is apply the conditional formatting for the second row to all other rows (about 40). I can't see a way to copy the conditional formatting and I don't really want to enter the three of them 40 times.
Any ideas?
Thanks
Related
I am trying to setup conditional formatting so that the formatting takes effect if the previous 4 cells in a column are blank. I need the range inside the conditional formatting formula to move as it is applied to cells below it, for example:
If I am tracking sales by store, if there is a 4 week period where a certain store doesn't record any sales I want those 4 weeks to automatically highlight.
My current formula is to select cells B5:B11, enter the formula =SUM(B2:B5)=0 to trigger the cell highlighting.
My problem is that when I look at cell B6 the range it looks for to be blank is still B2:B5 and I need it to be B3:B6.
Is there a way to set this up so that the range will change as it moves down a column?
This one has gotten me thinking a bit, and here is my solution for it.
My solution needs to use four conditional formattings, i.e. set up four conditional formattings in each cell, and then use format painter to apply the conditional format to all the cells.
Suppose your week table is in range A1:D20, and suppose you want to highlight cells if there are at least (not only) four consecutive blank cells.
Highlight cell B2, and then set up conditional formatting using the following four formulas:
=SUM(OFFSET($B2,0,0,4,1))=0
=SUM(OFFSET($B2,-1,0,4,1))=0
=SUM(OFFSET($B2,-2,0,4,1))=0
=SUM(OFFSET($B2,-3,0,4,1))=0
Then should have something similar to the following when examing the conditional formatting window:
Lastly, highlight cell B2, use the Format Painter function under Home tab and then apply the format to the rest of the cells in the week table. Then you should have something similar to the following:
It is easy to find the first blank cell of four consecutive blank cells, but it is difficult to identify the second, third and fourth blank cells using one formula. The workaround uses four different formulas to identify each of the four blank cells (I hope this makes sense). Please note the following is only looking at Column B of my example, not all columns:
Not pretty, but it works. This will highlight all occasions where the store has at least 4 weeks of consecutive donuts.
Columns B:D = Original Data
Columns E:G = Helper Set 1
Columns H:J = Helper Set 2
There's probably a way to get just one helper set, but this works and was easy to validate. First I added 3 empty rows above week 1.
In cells E4, E5 and E6 place a 0. You don't have to, you could also leave these blank.
Cell E5 formula, which is counting the number of consecutive blanks:
=IF(ISBLANK(B5),E4+1,0)
Drag it over to column G and drag it down.
Cell H5 formula, which is looking at 4 weeks later to see if there were consecutive blanks found in helper set 1:
=IF(E8>=4,"Yes","No")
Drag it over to column J and drag it down. Also, in the row above it, repeat week 1 values.
Lastly, select your original data range (B5:D14) and create this conditional formatting formula:
=(OR(H5="Yes",H4="Yes",H3="Yes",H2="Yes"))
Once you're satisfied, you can hide rows 2:4 and can also hide your helper columns.
Apply the following condition to each respective ranges:
Range: B2:D2:
=SUM(B2:B5)=0
Range: B3:D3:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0)
Range: B4:D4:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0, SUM(B4:B7)=0)
Range: B4:D8:
=OR(SUM(B2:B5)=0, SUM(B3:B6)=0, SUM(B4:B7)=0, SUM(B5:B8)=0)
Result with sample data:
Sheet1
[
Sheet2
[
On Sheet 1 I have four columns Col A= 1st adjustment, Col B= 1st Check, Col C= 2nd Adjustment, Col D= 2nd Check.
The values in these columns are either 0 or non 0. Always a number. For the two adjustment columns I format them to be Red (if they are non-zero) and for the two check columns I format them to be Yellow (if they are non-zero).
On sheet 2 there is a column that pulls and combines the the sets of adjustments and checks and assigns them to the correct employee ID #.
Somehow I need the formatting on the column in sheet 2 to be red if the number came from an adjustment column on the other page and yellow if the number came from a check column on the other page. And no color if it is equal to 0.
What is the best way to do this? I have not been able to find a solution.
The conditional formatting rules I have are all applied to column C Sheet 2. They are:
#1- Cell value equal to = 0 (no fill)
#2 Cell value equal to =Sheet1!$E1 (yellow fill)
#3 Cell value equal to =Sheet1!$C1 (yellow fill)
#4 Cell value equal to =Sheet1!$D1 (red fill)
#5 Cell value equal to =Sheet1!$B1 (red fill)
Assuming that both lists start in A1, put this formula in cell D2 of Sheet2:
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))
Then select the range C2:C13 and open the conditional formatting menu. Add 3 new rules based on formula. The first formula is:
=D2=1
and set the format as filled in red. The second formula is:
=D2=2
and set the format as filled in yellow. The third formula is:
=D2=0
and set the format as unfilled (which is not the same as no format selected). This last rule is not strictly necessary if none is going to change the format of your range manually. Still...
Note that each formula for the conditional formatting is written without any $ that would lock the reference. Therefore each cell in the range $C$2:$C$13 will translate that formula relatively to its own position. Cell C2 will "look into" cell D2, cell C3 will look into cell D3, C4 into D4 and so on. You can of course hide column D and the conditional formatting will still work.
You could also make it without using an extra column. Just edit the formula meant for cell D2 accordingly and use it in your rules. Something like this should work:
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))=1
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))=2
=IF(C2=0,0,IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2))=0
Formula details (as asked in comments)
B2 is for the row. In the context of the INDEX function it says at what row of the range ($B$2:$E$7 in the formula we see here) the INDEX function has to "look". If B2 is 1, it will consider the first row of the range (in our case row 2). If it's 2, it will consider the second row (in our case row 3).
(A2-1)*2+1 stands for the column. In the context of the INDEX function it says at what column of the range ($B$2:$E$7 in the formula we see here) the INDEX function has to "look". If the result is 1, it will consider the first column of the range (in our case the B column). If it's 2, it will consider the second column (in our case the C column).
About (A2-1)*2+1: let's change it a bit so it will be easier to visualize while i explain it:
1+(A2-1)*2
We can divide the formula in 2 parts: the 1 which stand as our starting point (the first column) and the (A2-1)*2+1 which deal with the shift in columns according to the shift in weeks. In cell A2 we find the number of the week. In the first sheet we have 2 columns for each weeks. Therefore when the week shifts by 1, our target column will have to shift by 2. We can't just multiply by 2 the week sheet because it's the shift from the first week that counts for 2, not the actual value. At the first week we will have no shift. Therefore our shift will have to be 0; but we can't just use a 0 because there is no "zero column" in a range. Therefore we need to have our starting value of 1 that is summed to the shift. This way for the first week we will have:
1+(1-1)*2
1+(0)*2
1+0
1
First column of the range $B$2:$E$7 (which is column B). For the second week we will have:
1+(2-1)*2
1+(1)*2
1+2
3
Third column of the range $B$2:$E$7 (which is column D).
Over all the formula IF(C2=INDEX(Sheet1!$B$2:$E$7,B2,(A2-1)*2+1),1,2) basically checks if the value in C2 is the same as the first column of the given week. If it's the same value it returns 1, otherwise it returns 2 (basically assuming that the value will be equal to the one in second colum of the given week).
Report any question you have or bug you have encountered. If, according to your judgment, this answer (or any other) is the best solution to your problem you have the privilege to accept it (link).
Let me give you a general approach for conditional formatting, based on a formula:
First you try to set up your formula, which you enter in some cell. The result of the formula should be TRUE in case you want the formatting to be applied, and FALSE in all other cases.
Please edit your question again, showing the formula you have tried for configuring this.
Oh, you just want to copy the formatting of that first sheet. But tell me, how is the formatting of that first sheet determined? Is it also the result of a conditional formatting? And about the numbers of the ADJ/Check column, is that just the sum of the values in the first sheet?
I have a spreadsheet where I concatenate User ID + Date to have unique identifiers for employees on that date. The only issue is they have 4 punches which means that there is two lines of that unique ID. Below is my attempt at showing my spreadsheet (A B C) are columns. My issue that sometimes in column D there can be the word "vacation, sick, etc" if the person took the day off. It can be on the first line or the second line which means I can't do a standard Vlookup to flag it. What would be the best formula to use to flag if the unique identifier has time off either on the first or second line? All it would have to do is see if there is data in any column D relating to that unique identifier I think
A________ B____ C__D
929ID123 9AM 12PM
929ID123 1PM 4PM Sick
I am trying to get it to look like
A________ B___ C_D_E
929ID123 9AM 12PM
929ID123 1PM 4PM Sick flag
You need a COUNTIFS Formula - it counts the number of lines that meet multiple criteria (different from COUNTIF which only allows one criteria).
By 'Flag it' you could use Conditional Formatting or a formula in a different column, whichever works best. Both options listed below;
Formula:
Let's say your formula flag is in column E. In the first row of data (usually E2 if your columns have headings) paste the formula =IF(COUNTIFS($A:$A, $A2, $D:$D, "*")>0, "FLAG", "").
That formula will write FLAG in lines with that ID and any non-blank value in column D.
Conditional Formatting
Select all of column E, then in the Home tab under styles > Conditional Formatting select 'new rule'. Set the rule type to 'use a formula' and paste the formula =COUNTIFS($A:$A, $A1, $D:$D, "*")>0 in the formula box. Then click 'Format' and choose how flagged cells should show, e.g. a red fill or orange border. Hit ok when done and voila - any flagged cells will have that format applied to them.
I have two different columns. Each one contains timestamps in hh:mm:ss format, and I want to do a between comparition and check if the Value Colum 2 is between Value Column 1 Row 1 and Value Column 1 Row 2, and then, paint the cell in green, or in red if the condition is not satisfied.
Here my columns:
Column 1 Column 2
16:06:13 16:07:34
16:06:41 16:08:42
16:08:39 16:09:49
16:09:47 16:11:02
16:10:53 16:12:10
16:12:08 16:13:40
16:13:39 16:14:48
16:14:47 16:16:04
16:18:06 16:18:06
I applied a Conditional Formatting -> HighLight Cell Rules -> Between
then from Column 2 Row 1, I selected the first value from Column 1 Row 1 and the next value from Column 1 Row 2, but nothing happens.
Anyone can help me?
Thanks!!
Following the process you did:
Highlight the values in Column 2
Conditional Formatting -> Highlight Cell Rules -> Between
Select the first value from Column 1 Row 1 then delete the dollar signs
Select the second value from Column 1 row 2 then delete the dollar signs
Note: I see that there is sometimes a glitch in some versions of Excel which replaces your cells with cells at the bottom of the spreadsheet. I find if I just repeat the steps another time, it fixes the issue.
Two rules with two different formulas:
1st:
=MEDIAN(B1,A1,A2)=B1
And format it to Green
2nd:
=MEDIAN(B1,A1,A2)<>B1
Another alternative method:
Highlight the values in column 2.
Conditional Formatting -> New Rule
Select "Use a Formula to determine which cells to format"
Under "Format values where this formula is true", input: "=AND(B1 >= A1,B1 <= A2)"
Select "Format..." and choose the formatting you want
Click OK
Note that this method, vs. the other one I gave you, treats the last cell differently (since there's no value after it). The first one will highlight it, this one will not.
Note: With both methods, I see that there is sometimes a glitch where Excel replaces your cells (A1, A2, and B1 in this case) with cells at the bottom of the spreadsheet. I find if I just repeat the steps another time, it fixes the issue.
If you wish to stick with in-between you can
The data I have in those two fields is
=INDIRECT(ADDRESS(ROW(),COLUMN()-1))
=INDIRECT(ADDRESS(ROW()+1,COLUMN()-1))
You will still need two of these as said in other answers.
I'm fairly new to Excel and so not very experienced, but I'm trying to get an entire row to highlight red based on 2 other cells, using conditional formatting. The requirements are for the corresponding M cell in the row to have the value 'N' and for the corresponding E cell to have a past date value '<*NOW'.
I've tried a formula based on an answer for multiple conditions:
=AND(M="(N)";E<*NOW)
A formula for formatting an entire row:
=INDIRECT("m"&ROW())="N",("e"&ROW())E<*NOW
And combining the two:
=AND=INDIRECT("m"&ROW())="N",=INDIRECT("e"&ROW())E<*NOW)
(ignore all the asterisks its the only way i could get the NOW to appear)
None of these are working, please help!
Assuming your data starts at row 2 then select all rows, e.g. 2 to 100 and then apply the condition for row 2, i.e. use this formula
=AND($M2="N",$E2<TODAY())
That will now apply to the whole range. The $ signs make it format the whole row