+ Reply to Thread
Results 1 to 10 of 10

Conditional Formatting

  1. #1
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Conditional Formatting

    Hi all

    i have the following code to condition format a cell if its greater than another cell + the figure in another cell (make sense so far) i want to condition format the same cell if its less than a figure too can i tidy up the code i have and add it to it?

    The formular for the less than will be

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  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 Formatting

    Quote Originally Posted by OillyBob55 View Post
    greater than another cell + the figure in another cell
    That is not what your formula says. It says "greater than another cell times the figure in another cell." Can you clarify what you are doing?
    Last edited by 6StringJazzer; 08-29-2017 at 09:35 AM. Reason: changed "equals" back to "greater than"
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    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 Formatting

    Do you want to format the cell if it is

    greater than $L$31*$Q$31 AND less than $L$31*$R$31

    or

    greater than $L$31*$Q$31 OR less than $L$31*$R$31

    ?

  4. #4
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Conditional Formatting

    Hi Jeff

    Sorry i want to greater than $L$31*$Q$31 OR less than $L$31*$R$31 i have a band in the middle that i am aim for so its OR wont be AND.

    Thanks

  5. #5
    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 Formatting

    Replace your first line of code with:

    Please Login or Register  to view this content.
    I have not tested this but would be happy to do so if you provide your file.
    Last edited by 6StringJazzer; 08-29-2017 at 01:47 PM.

  6. #6
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Conditional Formatting

    Thanks Jeff

    I have changed the code and added the cell i want the formula to work in "M31" i am getting conditional formatting in that cell but it dose not appear to be highlighting it.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Conditional Formatting

    I have knocked together a quick book to test it
    Attached Files Attached Files

  8. #8
    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 Formatting

    You have to use the code exactly as is. Do not change A1 to M31. Range("A1") means "the first cell in the range if they have selected more than one cell."

    Also I included too many quotes.

    Here is the corrected version.

    I am thinking you really want AND but I didn't change it. Every number will always be greater than the first number or less than the second, if the second is greater than the first.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: Conditional Formatting

    Thanks Jeff that works but it doesn't work with my set up. That will condition format cell "M31" i put some code in to always select "M31" i have some other code that drops data into that table and moves the list down by one. Th conditional formatting stays with the cells as they move down but the cell its looking at is away "M31" the formula increases by one each move but not the cell its looking at.

    =OR(M31<$L$32*$R$32,M31>$L$32*$Q$32)

    So the cells in red need to match the number ones in the equation

    Not sure that makes any sense

  10. #10
    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 Formatting

    You might want to read up on how conditional formatting works. When you have one CF formula that applies to multiple cells, the cell reference is always the same.

    Maybe this will 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: 1
    Last Post: 12-08-2016, 03:14 PM
  2. Replies: 9
    Last Post: 03-07-2016, 10:39 AM
  3. Conditional Formatting Removing Previous Conditional Formatting?
    By CravingGod in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2016, 01:02 PM
  4. Replies: 6
    Last Post: 01-08-2016, 06:44 PM
  5. Opening xlsm files with conditional formatting opens with removed conditional formatting
    By Martijn.Steenbakker in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-07-2014, 05:38 AM
  6. Replies: 1
    Last Post: 09-20-2013, 06:23 PM
  7. Replies: 3
    Last Post: 05-15-2012, 04:13 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