+ Reply to Thread
Results 1 to 6 of 6

Conditional Formatting with IF command

  1. #1
    Registered User
    Join Date
    01-21-2022
    Location
    Oxford, England
    MS-Off Ver
    2016
    Posts
    21

    Conditional Formatting with IF command

    I'm looking to do the below in a cell but I have no idea how to make it work

    IF F2 is between (C2-E2) and (C2+D2) then CELL says PASS (green cell colour with black text) UNLESS H2 AND/OR I2 are populated, in which case it becomes between (C2-H2) AND/OR (C2+I2)

    IF F2 is not between (C2-E2) and (C2+D2) then CELL says FAIL (red cell colour with black text) UNLESS H2 AND/OR I2 are populated, in which case it becomes not between (C2-H2) AND/OR (C2+I2)

    TIA
    Attached Files Attached Files
    Last edited by harrylucas; 03-29-2024 at 11:29 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Conditional Formatting with IF command

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Conditional Formatting with IF command

    These entries are identical in terms of the criteria:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    2
    1U Diameter
    7.000
    0.100
    -0.100
    7.000
    mm
    PASS
    IF Actual is between UL and LL, unless Min and/or Max Concession are present, overwriting UL / LL
    3
    1V Diameter
    7.000
    0.100
    -0.100
    7.000
    mm
    FAIL
    IF Actual is not between UL and LL, or Min and/or Max Concession limit if they are present
    Sheet: TABLE

    So how can one be a pass and the other a fail?

    Please give FIVE rows showing FIVE DIFFERENT scenarios (including override values) and their EXPECTED RESULTS.
    Last edited by AliGW; 03-29-2024 at 11:49 AM.

  4. #4
    Registered User
    Join Date
    01-21-2022
    Location
    Oxford, England
    MS-Off Ver
    2016
    Posts
    21

    Re: Conditional Formatting with IF command

    One isn't a PASS and one isn't a FAIL, I added that to explain the output I was after. I have updated the 5 cells with actual values and what would be a pass or a fail
    Attached Files Attached Files
    Last edited by AliGW; 03-29-2024 at 12:12 PM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Conditional Formatting with IF command

    Not a very sensible thing to do!!!

    No need to quote whole posts - don't do it, please (it's just clutter).

    I'll have a look at the new sample workbook.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Conditional Formatting with IF command

    Here's the formula:

    =IF(A2="","",IF(AND(F2>=C2+IF(H2="",E2,H2),F2<=C2+IF(I2="",D2,I2)),"PASS","FAIL"))

    Then you can set two CF rules, one for PASS and one for FAIL (I presume you know how to do this bit).
    Attached Files Attached Files
    Last edited by AliGW; 03-29-2024 at 12:22 PM.

+ 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: 01-23-2020, 06:07 AM
  2. [SOLVED] Conditional formatting - Looking for a NoMatch type command
    By westsidebill in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-17-2018, 07:52 PM
  3. [SOLVED] Override conditional formatting (in general, without changing the conditional formatting)
    By Stormin' in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2017, 07:15 AM
  4. Replies: 2
    Last Post: 09-12-2016, 01:33 AM
  5. How to make the command button override the conditional formatting
    By SerraAngel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-05-2014, 04:03 PM
  6. 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
  7. [SOLVED] Submit button - how to add command 'remove' conditional formatting in code?
    By WillGe in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2012, 08:34 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