Comments on: Excel conditional formatting formulas based on another cell

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 44. Total comments: 1726

  1. if i have one date, that date is smaller than other date. for this which formula i can use

  2. Sir,
    I am having spreadsheet containing D cell value K cell value , what is the formula for if K value is not equal to D cell value ?

    Please reply.

    K.R. Ranganath

    1. Hi Ranganath,

      Assuming that row 2 is your first row with date, here's the formula:

      =K2<>D2

  3. Hi there,

    I don't know if you can help me but it's worth a try! I am looking for a conditional formatting formula that will help me do the following...

    If cell A1 is a colour (i.e. determined by conditional formatting rules) then make another cell the same colour without changing the original function in the second cell.

    Thanks!

    Ian.

  4. Hello

    If I want to write a conditional formatting that for example it should find for me if the fifth number in a certain cell is 0 then make the cell red
    12340
    or1,2340
    how do I write it

  5. hi
    if i have two dates on one cell. i need to change the color if the send date added

    1. i mean 2nd date added

  6. HI,
    I want to color a cell based on another cell value.
    if cell D1 contains "false" I want to get red color in cell A1.
    How can i do that?

    Thanks
    Nazmul

    1. Hi Nazmul,

      Simply select entire rows and create a conditional formatting rule using the same formula.

    2. Hi Nazmul,

      If FALSE is entered in D1 as a logical value (Boolean), then you can create a rule for cell A1 (or multiple cells in column A) with the formula: =D1=false

      If you have "false" as a usual text, then enclose it in double quotes in the formula:
      =D1="false"

      1. Hi Svetlana,

        Thanks..it works.

        I have another problem. I want to change a row color for a cell value of those row..How can I do that?

        Nazmul

  7. Is it possible to include multiple conditions using both AND and OR operators in the formula for conditional formatting. Can you please provide a syntax for this.?
    Thank you in advance!

    1. Hello Ahamed,

      Of course, it is possible. One an AND function can be one of the conditions in the OR function and vice versa. For example:

      =AND(B1=2,OR(C1=3,C1=4))
      =OR(AND(B1=2,C1=3),C1=5)

  8. HI,

    I have a spreadsheet for cashflow that tracks down my everyday expenses. On another tab, i have a consolidated tracker that includes my businesses and investments. The problem is i keep on substituting a certain entry in the consolidated tracker because i dont know how to reflect the latest cash i have base on the cash flow tab as of the current date. Here is the example:
    Cell A Cell B

    20Nov14 $500
    21Nov14 $400
    22Nov14 $350
    23Nov14 $100

    cash as of today: ????

    I wanted excel to always pickup the cash based on the current date. Let's say today is 23Nov14.

    Thanks,
    Ben

    1. Hi Ben,

      Please clarify what exactly result you want to get: expenses for 23-Nov-14 ($100), a sum for the previous days in November or something else?

  9. Hi,
    I have a formula for my sheet with vlookup..for ex:In the cell A2 if i type "Apple" than the rest of the cells in the row gets filled up automatically like B2 with "fruit"
    C2 with"Red".But if SOMEONE TRIES TO CHANGE THE FORMULA for ex.. enter something other than the "fruit" in B2 or other than "Red" in C2 the color of the particular cell should change to red and No fill when they change the values back to formula...

    Thank you very much in advance!

  10. The techniques you outlined work great unless you have data in merged cells. My "applied to" cells are merged. It appears that the formatting chosen in the merge dominates the conditional formatting. If I set up my conditional formatting, then double click in the cell, I can see the result of the conditional format, however as soon as I leave the cell, the formatting is gone. Any way to remedy this?

  11. Hi,

    Can you help me please?

    If cell A1 = 1, I want the maximum value in the range B1:B5 to be highlighted red. If cell A1 doesn't = 1 then no conditional formatting needs to take place.

    Any ideas?

    1. Hello Andy,

      Select the cells B1:B5 and create a rule using this formula:
      =AND($A$1=1,Max($B$1:$B$5)=B5)

    2. This worked:
      Select range B1:B5.
      Conditional Formatting > New Rule.
      >Format only cells that contain.
      Cell Value > equal to > =IF($A$1=1,MAX($B$1:$B$5))
      Format > Fill > Red.

  12. Hi, I want to apply conditional formatting for "not equal to" clause. The cell is getting highlighted if I choose from the provided options like equal, greater than but not getting highlighted if I manually enter a formula for not equal to. Im using this formula : =$D25490
    Thanks !

    1. $D25490

      1. Hi!

        This formula does not look correct (maybe was distorted when publishing). Anyway, if you can specify what exactly cell(s) you want to highlight and based on what exactly condition (not equal to a certain number or another cell?), I think I will be able to suggest the right formula.

        1. The not equal to operator did not get published! Anyways, I have a column named cost code under which I want to highlight all the values which are not equal to 5490.

          1. Our blog engine often cuts off the "not equal to operator" in comments, argh! Anyway, your formula (=$D2<>5490) is correct. Just make sure you are selecting the entire cost code column (without the column header!) when creating the rule, and row 2 is your first row with data.

            If the rule still does not work for you, you can send me your sample worksheet (support@ablebits.com) and we'll try to figure this thing out.

  13. I have a pivot with conditional formatting. I now need to add more columns of data to the pivot. When I do that the column references called out in the conditional formatting don't change and I lose the formatting.Is there a way to do this without losing the formatting?

    1. Hello Alex,

      I am sorry, it is difficult to recommend anything without seeing your data. If you can send your sample workbook to support@ablebits.com pointing out the column you want to add, our support team will try to help.

  14. Hi,

    For this task, you need a usual IF function rather than conditional formatting. For example, these are the formulas for cell B3:

    =IF(B2="yes",Sheet2!B3,"")

    =IF(B2="no",Sheet3!B3,"")

  15. Hi,

    I need to edit / fill cells if a certain cell in the row contains 'Yes' or 'No' with the contents of cells from another sheet.

    For example,

    On Sheet1, If B2 = 'Yes' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet2.

    And on sheet1, if B2 = 'No' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet3.

    How do I manage this, I have been trying all day!

    Thank you in advance for any help you can give...

  16. Hi
    I am trying to figure out a formula that will identify the same number within a column, and within that range compare the sums of 2 other columns to see if they are equal, with an output of anything ("same", colour whatever) or to just be left alone if the sums don't add up.
    Example:
    Invoice # Dr Cr
    111 14 0
    111 0 12
    111 0 2
    222 4 0
    222 0 3
    would result in
    SOMETHING
    SOMETHING
    SOMETHING
    222 4 0
    222 0 3

    Is this possible?

    I have over 26,000 lines of data that need to be identified by an invoice # if the Dr don't equal the Cr...please tell me there is a way!!

  17. Hi Svetlana

    Great source of information. I came across it searching for a solution to a problem I have. In one column (say column 'A') I have a list of activities that need to be completed. In another column (say column 'B') I enter the percentage of the task in column 'A' that has been completed. I would like the first column to be filled with a data bar based on the percentage that has been entered in column 'B'. Probably dead easy but I can't figure it out. Be really great if you can help.

    Thanks
    Shaun

    1. Hi Shaun,

      Unfortunately, it is not possible to fulfill your task using Data bar, or at least we don't know how. Data bar works only with the information in the same cell.

      The only alternative we can suggest is to insert a helper column to the left or to the right of column A, enter the formula =$C2 there and copy it down to other cells. Then you can apply a conditional formatting rule to this column by selecting the Data Bar format style and turning on the "Show bar only" option.

  18. I am attempting to write a conditional format that allows me to see when the value in one cell is larger than another, then shade the larger cell darker as the difference becomes greater.

    A1 = 95
    A2 = 96

    In the above example, A2 is larger and would become filled with a color,the difference is 1. But if the difference were 5 (A2 = 100) then I would want cell A2 to fill a darker shade.

    I tried using standard deviation and color scales, but because there are only 2 number being compared, it does not seem to work the way I had hoped.

    Thank you for any advice you may have!

    Gary

    1. Hello Gary,

      I am sorry, I don't know a way to fulfill your task using Color Scales. As an alternative, you can try creating several rules based on formulas:

      =AND(A2-A1>=0, A2-A1<=2)
      =AND(A2-A1>=2, A2-A1<=5)
      =AND(A2-A1>=5, A2-A1<=10)

      1. Hi,

        I was having the same issue and I manage to solve it using Color Scales. :)
        Try the following:
        - Select the range (a1:a2 in your example) and enter in the Conditional formating > New Rule > Format all cells based on their values
        - Select 3-Color Scale
        - In the "Minimum", select Type "Formula" and write the following formula: "=MIN($A$1:$A$2;1)"
        - Let the Midpoint with the percentile
        - In the "Maximum", select Type "Formula" and write the following formula: "=MAX($A$1:$A$2;100)"

        The further the diference between the values of the cells, considering a potential maximum of 100 and minimum of 1, the darker de cell color.

        Hope this helps.

        Cheers.

  19. Hi,

    I need to edit / fill cells if a certain cell in the row contains 'Yes' or 'No' with the contents of cells from another sheet.

    For example,

    On Sheet1, If B2 = 'Yes' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet2.

    And on sheet1, if B2 = 'No' then I need B3,B4,B5 and B6 to contain the information from cells B3,B4,B5 and B6 from sheet3.

    How do I manage this, I have been trying all day!

    Thank you in advance for any help you can give.

  20. How can I set a conditional format, that will highlight a cell that changes in value upon refreshing its data load?

  21. 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?

  22. A really good post. Thanks.

  23. 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.

    1. 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.

  24. 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"

    1. Hello Musadiq,

      This is very easy. Simply select cell B2 and create a rule with the formula =A1="yes"

  25. 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

    1. 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?

  26. 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!!

    1. 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.

  27. 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.

    1. Hello Jason,

      Sorry, I don't exactly understand your task. Please describe in more detail what you want to get.

  28. 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.

    1. Thank you, Carlos.

      Unfortunately, I don't know the way to fulfill your task using a formula or a VBA macro. Really sorry.

  29. 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.

    1. 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"))

  30. 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?

    1. Hi Brian,

      Try creating a rule with this formula:
      =A2>AVERAGE(A2:A20)*1.5

      Where A2 is your first cell with data.

  31. 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.

    1. 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.

  32. 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.

    1. Hello Debbie,

      And what is the indication of a new customer?

  33. 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

    1. Hi Hilde,

      Try modifying your formula a bit by removing the $ sign from B2, like this:
      =ISNUMBER(MATCH("X";B2:$M2;0))

  34. 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... :-(

    1. Finally, I found it...
      In the ticket table all the cells will have a colour formatting based on:
      Formula is =COUNTIF(first_table;cell)

  35. 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

  36. 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

  37. 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

  38. 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

  39. 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!!

  40. 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!

    1. 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.

  41. 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

    1. 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="")

      1. 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..:-)

        1. 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.

  42. 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.

    1. 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.

  43. 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.

  44. 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!

  45. 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!!

    1. 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")

  46. Awesome thread, thanks a lot! Even though I didn't ask a question, my doubt got solved :)

  47. 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!

    1. Hello Susan,

      Simply select all the columns and create a rule using this formula:
      =countif($B:$B,$B2)>1

      1. Perfect - thank you SO MUCH! Have a great day!

  48. 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?

    1. 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.

  49. 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

    1. 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.

  50. 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.

    1. 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.

      1. 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!

        1. 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.

      2. 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)

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)