+ Reply to Thread
Results 1 to 4 of 4

Compare one cell to two sets of cells in a table - and add in conditional formatting!

  1. #1
    Registered User
    Join Date
    03-13-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2003
    Posts
    6

    Compare one cell to two sets of cells in a table - and add in conditional formatting!

    Hello everyone,

    I wonder if anybody can help me, please?

    I need to compare the value of a cell to see if it lies between the value of two other cells in a table, then if it does, to compare the last two digits of that number to see if they lie between two other values in two other cells, in the same table. A conditional format would be helpful to confirm/deny that the last two digits lie within the limits of the 3rd and 4th columns

    For example, if I have the number 41256 I can see that it is between the two columns of the second line, and the last two digits are between the last two columns of the second line. I've tried to show columns in my example, as best I can!

    38000 - 39999 | 53 - 60
    40000 - 41999 | 52 - 61
    42000 - 43999 | 51 - 61
    44000 - 45999 | 50 - 62
    46000 - 47999 | 50 - 63

    For the life of me, I cannot see how to get this to work. Any ideas anybody?

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Compare one cell to two sets of cells in a table - and add in conditional formatting!

    Where A1=41256 and your table is on Sheet2!A1:D5

    Select the first row on Sheet2

    Conditional Formatting
    New Rule
    Use a formula to determine...

    =AND(A1>Sheet2!A1,A1<=Sheet2!B1,RIGHT(A1,2)+0>=C1,RIGHT(A1,2)+0<=D1)
    Format as required

    Use Format painter (paintbrush icon) to copy to other rows
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    03-13-2012
    Location
    Moscow
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Compare one cell to two sets of cells in a table - and add in conditional formatting!

    Hello Special K,

    Thanks for your input. I understand that the formula is for conditional formatting, but cannot see see how it will help to compare anything other than that single instance.
    Just FYI, I have the data above in a defined-name table, called Test.

    Here's a link to a small sample of data with your instructions carried out, although not showing correctly.

    Thanks again!

    Duffgen

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Compare one cell to two sets of cells in a table - and add in conditional formatting!

    Ah, I see now.
    I think this is what you need

    2 conditions

    =AND(RIGHT(B2,2)/10 > =INDEX(K2:L13,MATCH(B2,I$2:I$13,1),1),RIGHT(B2,2)/10 < =INDEX(K2:L13,MATCH(B2,I$2:I$13,1),2))
    format as green
    =OR(RIGHT(B2,2)/10 < INDEX(K2:L13,MATCH(B2,I$2:I$13,1),1),RIGHT(B2,2)/10 > INDEX(K2:L13,MATCH(B2,I$2:I$13,1),2))
    format as red

    Remove spaces surrounding < > characters

+ 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: 0
    Last Post: 09-25-2015, 02:56 PM
  2. Conditional formatting to compare a cell to 120 cells
    By derrickrose2 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-05-2015, 02:41 PM
  3. Conditional Formatting - Formula to Compare Three Sets of Numbers - Take 2
    By Alan L 185 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-28-2014, 02:21 AM
  4. Conditional Formatting - Formula to Compare Three Sets of Numbers
    By Alan L 185 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-23-2014, 01:39 AM
  5. [SOLVED] Compare two sets of cell conditional format the second
    By kburns in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2012, 09:26 AM
  6. Replies: 9
    Last Post: 07-20-2012, 12:52 PM
  7. Conditional Formatting W/Icon Sets in Analysis Services Pivot Table
    By puffster in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-13-2011, 03:49 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