+ Reply to Thread
Results 1 to 17 of 17

Conditional format based on 2 columns

  1. #1
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Conditional format based on 2 columns

    Can anyone help me come up with a conditional formula for what I am trying to accomplish?

    I want to search a column (E) to find a value of a cell (E10) I am currently using this formula to do that:

    =NOT(ISERROR(MATCH(E10,$E$2:$E$9,0)))

    But I would also like to search column (F) to find a value of a cell (F10)

    If both cells E10 & F10 find its value in each of these columns AND they are in the same row then condition format the cells


    To help explain this I will tell you what I am trying to accomplish, I have a spreadsheet with dies we use, with these dies they have a size across and size around, whenever I enter a new die that needs to be order I enter both of those values (across & around) - I would like basically a warning saying I have already ordered a die with those sizes.

    I have attach a spreadsheet sample to help explain

    Thanks for you help,

    Mike
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional format based on 2 columns

    I replaced your two rules with a single rule that applies to E10:F10, since the same condition applies to both:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    Highlight columns E and F > Conditional Formatting > New Rule > Use a formula

    =COUNTIFS($E$1:$E1,$E1,$F$1:$F1,$F1)>1

    Format: Fill Color of your choice > OK > OK

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional format based on 2 columns

    Quote Originally Posted by 63falcondude View Post
    Highlight columns E and F > Conditional Formatting > New Rule > Use a formula

    =COUNTIFS($E$1:$E1,$E1,$F$1:$F1,$F1)>1

    Format: Fill Color of your choice > OK > OK
    I believe this will be true when both values are found, but does not take into account the requirement that they be in the same row.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    Quote Originally Posted by 6StringJazzer View Post
    but does not take into account the requirement that they be in the same row.
    I disagree.

    With multiple criteria, COUNTIFS works like an AND statement where the matches have to be in the same row.

    i.e. Count the number of instances where the value in E10 is found in E2:E10 AND where the value in F10 is found in F2:F10 (of the same row).

    Try it out!

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    Also, the CF formula (from post #3) was created under the assumption that the OP will be adding to the data.

    If a row 11 was to be added, I assume that the OP wanted the Conditional Formatting to then check rows 2 through 10 and be applied to E11 and F11 if applicable.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional format based on 2 columns

    Oh, absolutely right, my apologies.

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    No worries, let's see if it works alright for the OP.

    Thanks for the rep!

  9. #9
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Conditional format based on 2 columns

    63falcondude your formula worked very well with one exception, if I have text in some of the cells and not numbers will it not work?

    A few of my cells in column "E" say "gears" or "backer blade", etc.

    Thanks,

    Mike

  10. #10
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    It shouldn't matter if the cells are numbers, text, or a mix of both.

    Are you saying that the Conditional Formatting formula from post #3 doesn't work as expected somewhere?

  11. #11
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Conditional format based on 2 columns

    Correct, I am going to attach the full spreadsheet

    If you look at the first tab "die" the formula works great

    Take a look at the second tab "full sheet" I cannot seem to get it to work there unless I am doing something wrong

    Thanks for all your help!

    Mike
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Conditional format based on 2 columns

    I am sorry 6StringJazzer formula is the one that has worked for me - 63falcondude I cannot seem to get yours to work at all, see spreadsheet attached above.

    Thanks!

    Mike

  13. #13
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Conditional format based on 2 columns

    Re: Conditional format based on 2 columns
    Also, the CF formula (from post #3) was created under the assumption that the OP will be adding to the data.

    If a row 11 was to be added, I assume that the OP wanted the Conditional Formatting to then check rows 2 through 10 and be applied to E11 and F11 if applicable.

    You are correct I will be adding data to F11 ..... F12 .... Etc.

    Thanks!

    Mike

  14. #14
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    To implement the CF formula from post #3 to the FULL SHEET, first clear any existing Conditional Formatting.

    Highlight columns F and G (the entire columns) > Conditional Formatting > New Rule > Use a formula

    =COUNTIFS($F$1:$F1,$F1,$G$1:$G1,$G1)>1

    Format: Fill color of your choice > OK > OK

  15. #15
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Conditional format based on 2 columns

    Quote Originally Posted by 63falcondude View Post
    Also, the CF formula (from post #3) was created under the assumption that the OP will be adding to the data.

    If a row 11 was to be added, I assume that the OP wanted the Conditional Formatting to then check rows 2 through 10 and be applied to E11 and F11 if applicable.
    You are correct I will be adding data to F11 ..... F12 .... Etc.

    Thanks!

    Mike

  16. #16
    Registered User
    Join Date
    10-31-2016
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Conditional format based on 2 columns

    Quote Originally Posted by 63falcondude View Post
    To implement the CF formula from post #3 to the FULL SHEET, first clear any existing Conditional Formatting.

    Highlight columns F and G (the entire columns) > Conditional Formatting > New Rule > Use a formula

    =COUNTIFS($F$1:$F1,$F1,$G$1:$G1,$G1)>1

    Format: Fill color of your choice > OK > OK
    Works Perfect!!! Thank you so much!

    Thanks,

    Mike

  17. #17
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Conditional format based on 2 columns

    You're welcome. Glad we could help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 12
    Last Post: 02-19-2018, 12:32 PM
  2. Replies: 1
    Last Post: 05-23-2016, 01:53 PM
  3. Replies: 1
    Last Post: 05-16-2016, 03:06 PM
  4. Replies: 2
    Last Post: 04-28-2016, 08:25 AM
  5. [SOLVED] Format Spreadsheet - split text columns, rearrange columns, conditional format
    By lacke81c in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2015, 11:50 AM
  6. Replies: 2
    Last Post: 09-26-2012, 04:43 AM
  7. Replies: 0
    Last Post: 05-20-2011, 02:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1