+ Reply to Thread
Results 1 to 7 of 7

IF function - Logical test

  1. #1
    Forum Contributor
    Join Date
    07-06-2006
    Posts
    108

    IF function - Logical test

    Hi,

    In attachment you will find that the word test is written in both black and red. If it is written in red I want a function to add OK to the cell next to it.

    I believe an IF function can help me solve this. Is it possible to use the logical test to determine a color?
    Attached Images Attached Images

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: IF function - Logical test

    Quote Originally Posted by TomBP
    Is it possible to use the logical test to determine a color?
    Only if the initial colour is itself determined by logic (rather than arbitrarily) else you need VBA. Differentiation based on formatting is ill advised for this very reason.

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: IF function - Logical test

    Hi,

    You'll need a UDF such as this

    Please Login or Register  to view this content.
    to test the colour of the font.

    =IF(fontcolour(A1)=3,"OK","")
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: IF function - Logical test

    And note that altering the font colour of any given cell(s) manually is not a volatile action - ie no recalculation will be invoked - you would have to invoke manually (even if the UDF is made volatile).

  5. #5
    Registered User
    Join Date
    04-27-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: IF function - Logical test

    Quote Originally Posted by DonkeyOte View Post
    And note that altering the font colour of any given cell(s) manually is not a volatile action - ie no recalculation will be invoked - you would have to invoke manually (even if the UDF is made volatile).
    Alternativelly you can do the same with the help of "conditional formating"
    path: home-conditional formating

    regards

  6. #6
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: IF function - Logical test

    Alternativelly you can do the same with the help of "conditional formating"
    path: home-conditional formating
    I believe you'd still need to use a UDF in your conditional formatting. Regardless of where you put it, the UDF still needs a calculation to be invoked, or am I missing a trick?

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: IF function - Logical test

    Quote Originally Posted by sweep
    ...or am I missing a trick?
    No, not at all.

    The mention of Conditional Formatting is in this context of no consequence whatsoever.

    Conditional Formatting would only be relevant if applied to source values... this point has been covered previously, moreover there is nothing within the image uploaded that would allow us to determine the requisite logic for a Conditional Formatting based approach.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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