+ Reply to Thread
Results 1 to 7 of 7

Syntax for number range in conditional formatting

  1. #1
    Registered User
    Join Date
    06-09-2015
    Location
    California
    MS-Off Ver
    Excel Office 365
    Posts
    7

    Syntax for number range in conditional formatting

    I am definitely new to this and am wondering how, when using conditional formatting, I would code a number value range when using the 3 color scale. I have a total number (330) and want to create a condition where if number entered into cell is 0-110 cell is one color, then 2nd value would be 111-220 and third value 221-330, etc. Need specifics as I am code illiterate to some degree. Thanks!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Syntax for number range in conditional formatting

    Hi, welcome to the forum

    That is pretty straight forward.

    1. highlight the range you want to apply the conditional formatting to
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =$A2>220 format fill your color choice

    repeat 3&4 for the other rules...
    =A2>110
    1A2<=110

    Make sure the rules are this same sequence (largest to smallest), and check "stop if true"
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    06-09-2015
    Location
    California
    MS-Off Ver
    Excel Office 365
    Posts
    7

    Re: Syntax for number range in conditional formatting

    Thanks so much for the quick response. Don't I need to put a range of numbers in like: 0-110; 111-220; 221-330? AND what does the $ signify...do I need to include it?

  4. #4
    Registered User
    Join Date
    06-09-2015
    Location
    California
    MS-Off Ver
    Excel Office 365
    Posts
    7

    Re: Syntax for number range in conditional formatting

    Sorry but I am still unclear as to how to enter this info as the 3 color bar option (using Mac Excel 2011) doesn't allow for the coding you've provided. The classic option seems to only allow one condition per cell so what am I missing here?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Syntax for number range in conditional formatting

    Quote Originally Posted by Suzanne Irene View Post
    Thanks so much for the quick response. Don't I need to put a range of numbers in like: 0-110; 111-220; 221-330? AND what does the $ signify...do I need to include it?
    No, you dont. By looking for the highest number 1st =$A2>220, you effectively screen out all the lower numbers.
    Then when you use =A2>110 you again, screen out all the numbers below that. And keep in mind, the >220 has already taken care of the higher values.
    So, all thats left if =A2<=110

    The $ effectively "locks" the column, so that you can copy that across to other columns, and the "A" part wont change (so you can apply color to a row of cells, instead of just 1 cell)

    Sorry but I am still unclear as to how to enter this info as the 3 color bar option (using Mac Excel 2011) doesn't allow for the coding you've provided. The classic option seems to only allow one condition per cell so what am I missing here?
    hmm I dont use Mac, so Im not sure what the CF window there looks like. But the main thing is, you need to use the "Use Formula" rule, not any of the others

  6. #6
    Registered User
    Join Date
    06-09-2015
    Location
    California
    MS-Off Ver
    Excel Office 365
    Posts
    7

    Re: Syntax for number range in conditional formatting

    So...I can't get the order correct (from largest value to smallest) because Excel orders them the other way around
    no matter how I input them. I want to also have cell unchanged in color when there is no value input but it is filling
    in with red for some reason.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Syntax for number range in conditional formatting

    OK, can you upload your file here (as long as it contains no sensitive data)?
    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

+ 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: 5
    Last Post: 05-08-2015, 12:08 PM
  2. [SOLVED] Conditional formatting for duplicate values within a specific number range 2010
    By Nunzio in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-20-2014, 04:00 PM
  3. Conditional Formatting, Excel 2010, based on number of a certain text value in a range
    By trueimperfection in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-02-2014, 06:55 AM
  4. VBA Code Conditional Formatting based on number range
    By LMS0214 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-05-2011, 03:08 PM
  5. Conditional Formatting Syntax
    By t0030tr in forum Excel General
    Replies: 9
    Last Post: 05-02-2011, 10:28 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