This tutorial explains how to use Excel formulas to format cells and entire rows based on the values you specify or based on another cell's value, and provides a handful of formula examples. Continue reading
by Svetlana Cheusheva, updated on
This tutorial explains how to use Excel formulas to format cells and entire rows based on the values you specify or based on another cell's value, and provides a handful of formula examples. Continue reading
Comments page 45. Total comments: 1726
I have a spreadsheet with about 5000 rows. One of the columns is "File Status" that is filled with either a "A" (for active) or "C" (for closed). Is there a way to move a whole row based on that column to a new worksheet. Ideally, we would work from the worksheet with all the "A" files and when we close the file, we change the "A" to a "C" and the whole row could be moved to the sheet for Closed files. Also, if we reopen a file, is there a way to put on the Closed sheet a formula to move "A" files back to the original sheet?
A really good post. Thanks.
Drawing a blank.
If I want to set a condition format with an icon set where I get a "check mark" for zero and and "x" for anything greater than zero.
Seems very simple but I am not wrapping my head around it at the moment.
Hi Ben,
I have experimented a bit, and the following settings seem to work fine. Under Conditional formatting, click Icon Sets > More Rules and then set up:
X when values is >o (type - number)
"check mark" when <=o and >=0 (type - number)
X when when <o (type - number) (X will also appear for values less than zero, if any; or you can choose any other icon for this).
Hope this helps.
Hi team ,
i need to format a cell if another cell contain Yes ,
A1 contain Yes
Now I need to apply conditional formatting on B2 if A1 contain "Yes"
Hello Musadiq,
This is very easy. Simply select cell B2 and create a rule with the formula =A1="yes"
Reference: 120 80 Diagnosis
Measured: Systolic Dialatic Systolic Dialatic
Patient 1 111 75
Patient 2 105 75
Patient 3 104 80
Patient 4 126 86
Patient 5 120 69
Rule: Measured blood pressure -
- can be lower than the reference by 10 (0~10 lower are OK);
- can be higher within 5 (0~5 higher are OK)
- 11 ore more lower is diagnosed as "Lo BP"
- 6 or more higher is "Hi BP"
So the words "Hi" or "Low" wil lbe displayed
in the range of D6:E10
I need a formula for systolic using a Rule: Can you help me please
Hello Liana,
Shall we check these criteria "11 ore more lower" and "higher within 5" against both Systolic and Dialatic? Or "11 ore more lower" applies to Systolic and "higher within 5" applies to Dialatic? Also, in what columns do you have Systolic and Dialatic numbers of your patients and in what cells you have the corresponding reference numbers?
Hi Svetlana,
I have a data table and column Q is drop down list of an application status. Column P is populated with some values. My requirement is if a specific drop down value is selected from Col Q the corresponding col P value should become zero.
I have tried conditional formatting but it is throwing up circular reference issues. Can you please help?
Also, I have always admired the name Svetlana!!
Hello Subha,
It is not possible to change values in cells using conditional formatting.
You can enter the following formula in Cell, say P2, that will populate it with 0 once "Value1" is selected in cell Q2, otherwise, cell P2 will be empty.
=IF(Q2="Value1", 0, "")
If you want to change the current value in column P based on the section in your drop-down list, then a special VBA macro is needed.
Select a value from a drop down, then that selected drop down value (flags) changes a cells color on a different sheet depending on value selected from drop down.
Hello Jason,
Sorry, I don't exactly understand your task. Please describe in more detail what you want to get.
Svetlana,
Nice Work!
I want to know if is it possible to change the color of a cell when rollover another cell?
For example: if I get my mouse over the cell A1, the cell B4 change its color.
Thanks in advance.
Thank you, Carlos.
Unfortunately, I don't know the way to fulfill your task using a formula or a VBA macro. Really sorry.
Hello,
I'm trying to configure an "and" statement - I think.
I have a number of upcoming "jobs", all down column A. For each job, there are a number of "tasks", all across line 3. When a task for each job is completed, I simply put an x in the corresponding box.
My jobs all have a different start dates, and as of right now I have the estimated start date in column C. When the upcoming job starts within in 2 weeks, it highlights the cell orange using =AND(C4-TODAY()>=0,C4-TODAY()<=14). When a job has started, it highlights the cell red using =C4<TODAY().
Is there any way I can double-conditional format, where if a job is coming up within two weeks and some of the tasks for that job have not been completed, it will highlight that cell? Same with once a job has started. Thank you very much.
Hello Susan,
If my understanding is correct, you have each task in a separate column, say columns D-F. And you want to highlight a job that is coming within the next 2 weeks if _at least one_ task column is not filled with "X".
If so, you just need to embed the OR statement in your formula, like this:
=AND($C4-TODAY()>=0, $C4-TODAY()<=14, OR($D4<>"X",$E4<>"X",$F4<>"X"))
I'm trying to use conditional formatting to highlight a cell in a column red if the value of the cell is > 150% of the average of the values in the column. I've tried and tried,but nothing I have tried works. Can you please help?
Hi Brian,
Try creating a rule with this formula:
=A2>AVERAGE(A2:A20)*1.5
Where A2 is your first cell with data.
Hello,
I need a little help on what I think is a fairly easy formula, I am just having trouble finding exactly what I want.
If the date in C23, let's say it's 10/22/14, is between TODAY()-30 and TODAY()+30 then I want cell D23 to be filled red if it is still blank within that time frame.
Basically my spreadsheet will be tracking due dates in column C I have the date the document is due and in column D I have when someone turns in their document to me. So I want to be able to track if it is due in the next 30 days or up to 30 days late, if the date is between -30Today+30 and the cell in column D is still blank I want it to be filled red.
Hopefully that is clear enough. Thank you.
Hello Keriann,
This is crystal clear, thank you : )
Select cells in column D you want to color excluding the column header if any, and create a rule with this formula:
=AND($C2>=TODAY()-30,$C2<=TODAY()+30,$D2="")
Assuming that row 2 is your first row with data.
I want to apply conditional formatting to underline whenever there is a new customer. The spreadsheet is sorted to group customer orders together in rows. Each order is in one row and the customer name is in column B. I want to take it a step further and apply this to a macro for daily application to daily orders which may range from 60 rows to 500 rows.
Please help.
Hello Debbie,
And what is the indication of a new customer?
Hi Svetlana. Thanks for your very interesting postings !
I want to use conditional format to highligh cells in a row when there is an "X" filled in in that row; this works with the formula =ISNUMBER(MATCH("X";$B2:$M2;0))
Now I want to add a rule that only the cells before the "X" and the "X" itself are highlighted, but NOT the cells after the first "X" in the row.
Could you help ?
Thanks in advance,
Hilde
Hi Hilde,
Try modifying your formula a bit by removing the $ sign from B2, like this:
=ISNUMBER(MATCH("X";B2:$M2;0))
Hi there,
I have a table with 10 rows, 10 columns and another table as a bingo ticket (which has 3 rows and 9 columns, with 5 numbers on each row, randomnly distributed).
What I want to do is, if I enter a number (between 1 and 100) in my first table, the cell with a matching number in the bingo ticket will switch to a preformatted colour.
How can you do that ? I have tried with lookup and index functions, but without any success... :-(
Finally, I found it...
In the ticket table all the cells will have a colour formatting based on:
Formula is =COUNTIF(first_table;cell)
I need some help. I want to add values In column c where column d equals a term i.e account and display it in a cell on top.
C5 2 d5 account
C6 5 d6 boo
c7 2 d7 account
=4
But I need a way to search the whole column as a range because I am adding new rows daily
Hi Svetlana,
I want to use conditional formatting for monthly office time sheet. It has Time in and Time out column. I want to change the color of Time in column to change automatically to yellow color if it exceeds 10:00 am.
Looking forward for your response.
Regards,
Ajay Verma
Hi Svetlana,
I want to use conditional formatting for monthly office time sheet. It has Time in and Time out column. I want to change the color of Time in column to change to yellow color if it exceeds 10:00 am.
Looking forward for your response.
Regards,
Ajay Verma
Good Evening Svetlana,
I emailed you my spreadsheet earlier.
I am trying to use conditional formatting with the stop light icon sets. I was able to get one to work.
What I really need is for the parameters to be set based on the text from another cell.
Ex.
C3 says "Other", this could also say HC or MF.
Opportunity Analysis (OAS)
Name YRC
Vertical HC/MF/OTHER Other
Actual Total number of locations 400
Number of "Open Market" locations 300
Number of "Franchised" locations 100
Shared Savings Fee % 45%
Annual Waste Spend - Total 3,800,000
Annual Waste Spend - Open Market 2,850,000
Estimate % savings 20%
$ savings (open market) 570,000
Cass annual fee 256,500
Cass net monthly fee 21,375
Fee per location per month 71
MF Stop Light
Est. Fee per location per month > 85
Proceed with caution 75 - 84
Stop - See VP of Sales < 75
HC Stop Light
Est. Fee per location per month > 125
Proceed with caution 115 - 124
Stop - See VP of Sales < 115
Other Stop Light
Est. Fee per location per month > 85
Proceed with caution 75 - 84
Stop - See VP of Sales < 75
Based on the parameters above, how can I use conditional formatting in C14 to be dependent on which word has been typed in C3?
C14 currently holds the value 71 that was derived from a sum function =SUM(C12/C5)/12. C14 currently has a red background with a red light, but is not using C3 to base its rules off of. The rule is only coming from =$C$14. How can I get the parameters to apply "if C3 is this word" "then these rules would apply to C14"?
Thank you for any knowledge you can spare.
Monique
I am working in Excel 2007. I need to know how to reference conditional format of a cell based on another cells value in a different sheet. Essentially, I want the color of a cell on sheet 1 to change too red, green, or yellow based on a percent delta on sheet 2. The percent delta could change and if it goes up, I need the cell to turn red, down to green, and same is yellow.
I saw on a video that someone was able to do this by selecting the cell in the formatting rule, but my excel says, “You cannot use references to other worksheets or workbooks for Conditional Formatting criteria.” when I try.
Thanks in advance!!
This would be a lot easier if I could show you a picture, but here goes. For example, I want my cells to turn different colors based on the text inside them. So if the cell reads "apple" I want that cell to fill with the color red. If it reads "orange" I want the fill to be orange and so on. The cells I want to be automatically colored will not be in one column, but between 3.
Thank you for the help in advance and I look forward to your reply!
Christopher,
Simply select the range of cells you want to color depending on their values, e.g. A2:C100, and create a separate rule for each word:
Red: =A2="apple"
Orange: =A2="orange"
Where A2 is the top-left cell of the selected range.
Dear Svetlana,
I want to use formula or conditional formatting for below mentioned condition:
If i enter a date in one cell of column A and missed to enter some data in other cell of column B then color of cell of column B need to appear Red, and vice versa...
Please reply ...
Little Urgents..
Regards
Shubham
Hello Shubham,
You can create two rules as follows (assuming that row 2 is your first row with data):
For column A: =AND($B2<>"",$A2="")
For column B: =AND($A2><"", $B2="")
Hi Svetlana,
Suggested formula works .....Thanks a lot.
Could you please explain the logic behind as i have tried similar things but didn't succeeded earlier...
Thanks a lot for the solution, you deserve a treat from my side..:-)
Shubham,
I will try. The logic is actually pretty simple : )
For column A:
- You use the AND function to set 2 conditions.
- Condition 1 - a cell in column B is not empty: $B2<>"" (<> means "is not equal to", "" - no value)
- Condition 2 - a cell in column A is empty: $A2=""
The rule for column B is analogous.
An absolute column reference ($A - with the dollar sign) and relative row reference (2- w/o the dollar sign) tell Excel to adjust the formula for each individual row.
Hope this makes sense.
Hi Svetlana,
I am trying to get cells in a column to equal a value of 1 with numbers in the cells that could be 1-50,but the value of each cell still is counted as 1 so that I can get them to sum up at the end. Thanks.
Hi Bobby,
If my understanding is correct, you need to count the cells in a certain column with values from 1 to 50, inclusive.
If so, I can see 2 possible ways:
1. Use the following COUNIFS formula:
=COUNTIFS(A1:A10,">=1", A1:A10,"<=50")
Where A1:A10 is your range of cells.
2. Add a helper column with the following formula next to your column with numbers:
=IF($A1>=1,IF($A1<=50,1,""),"")
It will populate a cell in the helper column with "1" if a cell in the same row in column A is between 1 and 50. Then simply use Excel's AutoSum to count 1's.
Hi Svetlana,
I am trying to have any cells in Column Q that have an equal value as any cells in Columns A and B be formatted; with the values in Columns A and B continuously changing. I've only been able to input a successful formula that highlights equal values that are only within the same row. Thanks.
Svetlana,
Is there a way to make the color associated with a conditional formatting rule dynamic?
For example can I feed a value in cell A, a color in cell B, and make the conditional formatting formula's 'format' in cell C depend on the value of A but if true to present the background color indicated in B?
Thanks!
Hi Susan...Hopefully this isnt something that Ive missed, but I am needing advice.
I am using conditional fomatting to format an entire row if column G contains a conveying document type (eg. WD, TD..)
I higlighted the table, used:
=$G1="WD"
It worked great!!
My question is, I want it to be the same color for WD, TD, Exec Deed,...etc. Is there a way to have all these words in one rule? Or do I have to make a new rule for each word?
Thanks!!
Hi!
Of course, you can have them all in one rule by using the OR formula like this:
=OR($G1="WD",$G1="TD",$G1="Exec Deed")
Awesome thread, thanks a lot! Even though I didn't ask a question, my doubt got solved :)
I have duplicate values in Column B, and I would like to have the entire rows highlighted when a duplicate value is found in Column B only. Similar values may also be found in Column A, but I only want the duplicates from Column B to be considered when highlighting the entire row. How would I accomplish this? Thank you!
Hello Susan,
Simply select all the columns and create a rule using this formula:
=countif($B:$B,$B2)>1
Perfect - thank you SO MUCH! Have a great day!
I am trying to conditionally format an entire column based on the information from another column. For example, I want to highlight red in B1 a value less than that of A1. It will be green when greater than A1. I also want to highlight red in B2 when it is less than A2, green when greater than. So each value in column B needs to be highlighted with its corresponding A value. I just do not want to have to do this line by line for 50 items. Is there a way to do this all at once?
Hello Woody,
Of course, there is no need to create a rule for each row. You simply select all the cells in column B that you want to highlight, say B1:B50, and create 2 rules with the following formulas:
Red: $B1<$A1
Geeen: $B1>$A1
Since you use the absolute column (with $) but relative row (w/o $) references, Excel will adapt the formulas for each indibidual row and highlight cells in column B as you need.
My query is on conditional formatting with dates.
I have a spread sheet which has the following columns:
1. Todays date $B$1
2. Date entered for return of document $AJ4 lets say 3/10/2014
If column 2 has the date 3/10/2014 then highlight 30 days prior in red.
Thanks
Hello Jean,
I am sorry, it is not very clear how column 2 and $AJ4 are related. If you can send a sample workbook to support@ablebits.com, we will try to help.
This blog has been very informative, but I have not found an example of my problem yet. I simply want to highlight duplicates (preferably not the first occurrence) only when the values in two other columns match. In other words, I would like to find duplicates in column C only when the values in columns A and B are the same.
I've tried countifs formulas, but they are not working. I wonder if I need to use a match statement or something similar. Any advice would be greatly appreciated.
Many thanks.
I read over my comment and realized that it may be unclear that I want values WITHIN columns A and B to match, not match each other (for which I found an example). For example, duplicates would be highlighted in column C when values in column A = 1 and values in column B = 2, then duplicate searching would start new when values in either column A or B change.
Thanks again.
So, I have been continuing to work on this problem and I have the correct formula to highlight duplicates in a column if values within 2 other columns match. For example...
=COUNTIFS($B:$B,$B2,$E:$E,$E2,$J:$J,$J2)>1
However, I am having a hard time to avoid highlighting the first instance in this case with multiple columns.
I would also like to have a separate column that has a formula resulting in a "0" value when it is the first or only instance of a value in column J, only when the values within B and E columns match. Right now, based on something I found that explains how to do this in one column, I've tried to modify to include multiple columns like this formula...
=IF(COUNTIFS($B:$B,$B2,$E:$E,$E2,$J:$J,$J2)>1,0,NOT(COUNTIF($J$2:J2,J2)=1)),but I don't think it is dealing with the multiple columns well.
Again, advice on this would be appreciated.
Thanks!
Raineek,
I'm not sure I can completely follow you. If you need to highlight duplicates rows by comparing rows by several columns and highlight only the second and further occurrences, this can be dome using VBA or our Duplicate Remover add-in. Sorry, I don’t know a way to do this using Excel formulas.
Hello Raineek,
If my understanding is correct, you want to highlight C3 if any of the above cells contain the same value and if A3 is equal to B3.
If so, select the column C starting from C2 till the end of the table and enter this formula:
=AND($A2=$B2,COUNTIF($C$2:$C2,$C2)>1)
So I am creating my own budget sheet for uni, and I have almost done it. I am just stuck with one problem.
Based on my grant, I have £11.52 a day on average. This is £80.64 a month. To make sure I don't overspend (as we get a lump slum every 3 months) I am basing the budget on a day to day format.
My problem is, Say I spend £10 on the first day, this leaves £1.52. This money can then be split over the 6 other days meaning I would have £11.77. However, I can not find a formula that will allow me to do this. Say I spent £6.00 on my first day of the week. I would then have £12.10 for the other 6 days. Then if I continued to under spend, My daily budget would increase.
It currently looks like:
Date Daily Amount Spent
02 October 2014 £11.52 £0.00
03 October 2014 £11.52 £0.00
04 October 2014 £11.52 £0.00
05 October 2014 £11.52 £0.00
06 October 2014 £11.52 £0.00
07 October 2014 £11.52 £0.00
08 October 2014 £11.52 £0.00
Total Left £80.64 £0.00
Any answers anyone
Hello Adam,
You can deduct actual expenses from the weekly budget, then divide by the number of remaining days and you'll get your budget for a day. If you send your sample workbook at support@ablebits.com, I believe we'll be able to write a proper formula.
kept looking and found the answer on another site:
Highlight the entire area (all columns and rows with data); manage rules; create new rule, where A1 is first cell and O is last column:
=A1>=LARGE($A1:$O1,3)
Perfect! :)
Very nice blog!
I have a list (top to bottom) of let's say 100 customers, and their monthly sales (so Jan-Dec, right to left).
For each customer (ie, each line) I want to use Conditional Formatting to highlight each customer's best 3 months.
I can certainly do conditional formatting on each of the 100 lines, one by one, but that is extremely burdensome. Is there some way to highlight all 100 lines and all 12 months and have excel know to do it line by line and not just pick the three best results out of the whole range (1,200 cells)?
Thank you VERY MUCH!
Helo,
Again I want to ask for your help...
I have spread sheet and I need a sum up.just like this
if value in column A was duplicated the value in column B and C in that row will automatically sum up.
Thank you
Hello,
Good morning,I already figure it out last night.
Thank you very much
Hi Svetlana,
THANK YOU very much
It's really a BIG help for me...
And if column B is appreciated column D will be the same date as column C.
Thank you
Glenn
Hi Glenn,
Here is the formula for cell D1:
=IF(B1="Appreciated",C1,"")
Hi, Good morning
Can you please help me with my formatting problem.
I have an work sheet with several column. I need to format a column based on the other column. eg; column B will be Appreciated IF column A says Positive Behaviour.
Thanks in advance
Glenn
Hello Glenn,
Conditional formatting is not needed for this task. Simply put the following formula in cell B1 and then copy it down column B:
=IF(A1="Positive Behaviour","Appreciated","")
If your data starts, say, in row 2, then replace A1 with A2 and copy the formula in B2.
Thanks. This tutorial is brilliant. I used it to color my bank statement xls. It helps identify the Debit and Credit transactions in just a glance.
=$D13="DR"
Color Red for
=$E$13:$E$50
Wonderful tutorial!! Thank you so much!!
Hi Svetlana,
Could you please help with the below conditional formatting
I have a product (orange)
I have Stock on Hand (SOH)of 95Kg (CellD2) and I have and order for today of 45Kg (F2)and tomorrow 40Kg (G2).
Then I have a stock on order (SOO) of 100Kg (E2)
What I need is:
Highlight my orders in yellow when my SOH cover the QTY ordered then
Highlight my orders in red when my SOO cover the rest of my orders
Ultimately no highlighted cells if SOH and SOO doesn't cover my orders
Below example:
The 95Kg of SOH cover 24 and 25 of September with 10Kg left over
With my SOO of 100Kg plus the 10 left from SOH, (110Kg)cover the 26 but not the 27
Therefore (24 and 25) should be yellow, 26 should be red, 27 no highlight
Can you help
DC Article Description SOH SOO 24/9 25/9 26/9 27/9
656 369558 Oranges 95 100 45 40 56 75
Hello Michael,
You can use the following formula to create the "yellow" rule:
=SUM($F2:F2)<=$D$2
Also, make sure the "Stop if true" checkbox is selected for the "Yellow" rule in the rules' list.
The "red" rule should look as follows:
=SUM($F2:F2)<=($D2+$E2)
Hi Svetlana,
I have a question related to the similar topic. Would you be able to advise if a cell can be formatted/ formulated based on the value of a range of data in a row?
E.g. A row of data has been conditioned formatted to highlight the highest numerical value as bold blue while the rest which are not the highest numbers are in default black colour.
In a separate cell, if I were to key in the highest value or other value, can the cell be formatted to show what is exactly in the range of data which was conditioned formatted earlier?
Thanks a million!
I would like to use conditional formatting for multiple cells based on date. There are pending, completed and "blank" cells. I also need to create a tally based on the updated cells by location (I was thinking i could link the cell to a certain area within the sheet or even create a new sheet. I have six locations and I want to have the table "updated" automatically once a milestone has been completed? How can I do all of this for one sheet?
Thank you! I need all the help i can get.
I wanted to utilize conditional formatting to highlight cells that are 90 days away from a certain date. Then if it passes that certain date to become red. Can someone please help?
Hi there,
thank you for the great text. i recently downloaded an spreadsheet from excel built-in template called "Gantt project planner". I was wondering have you seen that file, I couldn't figure out how it used special formatting. If you can't find it. please let me know to explain more. anyway, I copied them in the following,
Actual =(PeriodInActual*(project!$E14>0))*PeriodInPlan
ActualBeyond =PeriodInActual*(project!$E15>0)
PercentComplete =PercentCompleteBeyond*PeriodInPlan
PercentCompleteBeyond =(project!BY$8=MEDIAN(project!BY$8,project!$E17,project!$E17+project!$F17)*(project!$E17>0))*((project!BY$80)
PeriodInActual =project!BY$8=MEDIAN(project!BY$8,project!$E19,project!$E19+project!$F19-1)
PeriodInPlan =project!BY$8=MEDIAN(project!BY$8,project!$C20,project!$C20+project!$D20-1)
Thank you very much if let me know how these formulas work for conditional formatting.
i used coding in java, Excel - Using formula(String formula = "SUM(Vouchers!E2 : Vouchers!E"+(rec+1)+")";) to reference values on other sheets(Vouchers) get 0 only, i directly apply this formula in excel sheet, got 86123.67, but reference to other sheet got answer of #Value, why this happen?
HI madaam,
I want to create formula that when I input letter on a cell, ex. L on b5 then
b6 will have letter v.
Hi Svetlana,
Great and very informative post.
In a large range A1:AK100, I need to highlight the first cell (A:A)in a row if ALL cells in the rest of the row are blanks. Please note that all cells contain formulas that either return a value or "".
Thanks
My query is on conditional formatting with dates.
I have a s/s which has the following columns:
1. Date Contract sent out
2. Date Signed contract returned (blank until it is returned)
3. 7 days reminder
4. 14 day reminder
5. 21 day reminder
If column 2 is blank, the highlight (I have this part done)
If column 2 is blank and 7 days have elapsed since date in column 1 then format cell green
If column 2 is blank and 14 days have elapsed since date in column 1 then format cell orange
If column 2 is blank and 21 days have elapsed since date in column 1 then format cell red
Thanks
Hi All,
I have two cells data as
A10 : if(a = b)
B10 : if((a = b) && (b = c))
I want the cell C10 to be
c10: if((a = b) && (b = c)), the extra chaecters are to be displayed in Bold RED colour.
Please help
A B C
149 86 554
if less than value is 86 then who can we highlight B in another cell