+ Reply to Thread
Results 1 to 12 of 12

Conditional FOrmatting

  1. #1
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Conditional FOrmatting

    Using Mac 2011 and I am trying to conditionally format a cell's text. IF K5>H5, I want the K5 text to be in RED. I close CLASSIC for style, "Use a formula to determine which cells to format" from the pull-down menu, and CUSTOM FORMAT to choose the color of red I desired. I then entered this formula:

    ="IF(K5>H5)"

    (also tried it without the "" marks)

    But no matter what value I have in K5, either < or > H5, it ALWAYS makes the font RED. The formula doesn't generate an error, so it is a correct argument. But why is it always coming out with a red font in every case? What do I need to do to get this formula to work?

    TIA.

    Rob

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Conditional FOrmatting

    Simply:

    =K5>H5

  3. #3
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Re: Conditional FOrmatting

    D'oh. THat was super simple. It works perfectly.

    When would i use the "IF" argument? Can you give me a simple example? Thanks PFDave. That was very helpful.

  4. #4
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Re: Conditional FOrmatting

    D'oh. THat was super simple. It works perfectly.

    When would i use the "IF" argument? Can you give me a simple example? Thanks PFDave. That was very helpful.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional FOrmatting

    With conditional formatting the IF is implied (it is "conditional" after all), so you need to build up an expression which effectively equates to TRUE or FALSE, such as:

    =A1>B1

    or:

    =ISNUMBER(MATCH(A1,B:B,0))

    or:

    =COUNTIF(C:C,A1)>2

    (These are just random examples, not necessarily related to your specific request).

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Re: Conditional FOrmatting

    Yes, it does. Thanks. What do the arguments

    =COUNTIF(C:C,A1)>2 and
    =ISNUMBER(MATCH(A1,B:B,0))

    mean in plain English? I've never seen a ":" other than with SUM(A1:A6), for example. So, C:C after COUNTIF is unclear to me, as is B:B.

    TIA.
    Rob

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional FOrmatting

    The colon is used to separate the start and end cell of a range. C:C or B:B just means the whole of column C (or column B).

    The expression:

    =COUNTIF(C:C,A1)>2

    means "does the value of A1 occur in column C more than 2 times ?" in plain English. The other expression:

    =ISNUMBER(MATCH(A1,B:B,0))

    means "is the value of A1 present anywhere in column B ?" in English. Both of these will have an answer of Yes or No (or TRUE or FALSE).

    Hope this helps.

    Pete

    P.S. If that takes care of your original question, please take a moment to select Thread Tools from the menu above your first post and mark this thread as SOLVED.

    Also, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

  8. #8
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Conditional FOrmatting

    Glad to have helped Rob

  9. #9
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Re: Conditional FOrmatting

    Just marked as solved. Thanks for the tips. The confusing part between COUNTIF and ISNUMBER is in the former, the search range appears BEFORE the cell value A1, in the latter, it's AFTER the cell value A1. Excel has so much stuff it's amazing.

    I get that COUNTIF says in column C, if A1 is there, add +1. But with the ISNUMBER, you're looking to see if A1 appears anywhere in column B, but the "0" at the end seems odd. I'll have to look that one up. This site is awesome. Thanks again to you and PFDave. You guys are rock stars.

  10. #10
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Re: Conditional FOrmatting

    Just marked as solved. Thanks for the tips. The confusing part between COUNTIF and ISNUMBER is in the former, the search range appears BEFORE the cell value A1, in the latter, it's AFTER the cell value A1. Excel has so much stuff it's amazing.

    I get that COUNTIF says in column C, if A1 is there, add +1. But with the ISNUMBER, you're looking to see if A1 appears anywhere in column B, but the "0" at the end seems odd. I'll have to look that one up. This site is awesome. Thanks again to you and PFDave. You guys are rock stars.

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional FOrmatting

    Strictly speaking, it is the MATCH( ... ) function which is looking to see if A1 occurs within column B - the zero at the end means "exact" match. If there is not an exact match, then the MATCH function would return an error (#N/A), but if it is found within the range it returns a number (which is the relative row number in the range), so the function is wrapped in the ISNUMBER( ... ) function in order to trap that error, i.e. if the Match function finds A1 within column B (i.e. it has returned a number), then return TRUE, otherwise FALSE.

    Hope this helps.

    Pete

  12. #12
    Registered User
    Join Date
    03-06-2014
    Location
    Hummelstown PA
    MS-Off Ver
    Excel 2011 Mac
    Posts
    15

    Re: Conditional FOrmatting

    Yes, it does. I tried it without the "0", and it kept coming up FALSE. So I added the 0, and it worked. Now i know why. Pretty neat.

+ 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. Conditional Formatting Removing Previous Conditional Formatting?
    By CravingGod in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2016, 01:02 PM
  3. Replies: 6
    Last Post: 01-08-2016, 06:44 PM
  4. Formatting Cells with Date or Text Values in a Conditional Formatting Formula
    By Phil Hageman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-15-2014, 09:36 AM
  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

Tags for this Thread

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