+ Reply to Thread
Results 1 to 6 of 6

conditional formatting with formula in cell

  1. #1
    Registered User
    Join Date
    02-09-2020
    Location
    vienna
    MS-Off Ver
    office 365
    Posts
    5

    conditional formatting with formula in cell

    hello,

    I want to conditional format my table based on a formula in another sheet, as i want to be able to quickly change the formula without having to go into the conditional formatting.
    f.e.
    AND(K$1>=$I8;K$1<=$J8;$E8="brand1";WEEKDAY(K$1;2)<>7)
    AND(K$1>=$I8;K$1<=$J8;$E8="brand2";WEEKDAY(K$1;2)<>7)
    --> i am using the same formula but for different brands --> different Colours so it would be way easier to change the formula only once and automate the linking to the brands and the conditional formatting

    does anyone know how to do that?

    any help and tips would be very much appreciated!

    thanks cricked

  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. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,140

    Re: conditional formatting with formula in cell

    Welcome to the forum.

    The bad news is that it cannot be done with an indirect reference in the CF dialog. However, there may be a way to do it with VBA.

    Nonetheless, you should attach a sample workbook so that we can better advise: instructions at the top of the page.
    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
    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,954

    Re: conditional formatting with formula in cell

    Another possible option may be to have a few different rules - 1 with each of your formulas, that would get triggered based input in your other sheet?
    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

  4. #4
    Registered User
    Join Date
    06-02-2019
    Location
    Mauritius
    MS-Off Ver
    2016
    Posts
    3

    Re: conditional formatting with formula in cell

    Hi , i want to stop the conditional formatting where my values stop in range D ( the values change everyday )

    find what im using

    Sub threecf()
    Dim rg As Range
    Dim cond1 As FormatCondition, cond2 As FormatCondition, cond3 As FormatCondition
    Set rg = Range("A2", Range("A2").End(xlDown))

    'clear any existing conditional formatting
    rg.FormatConditions.Delete

    'define the rule for each conditional format
    Set cond1 = rg.FormatConditions.Add(xlCellValue, xlGreater, "=$a$1")
    Set cond2 = rg.FormatConditions.Add(xlCellValue, xlLess, "=$a$1")
    Set cond3 = rg.FormatConditions.Add(xlCellValue, xlEqual, "=$a$1")

    'define the format applied for each conditional format
    With cond1
    .Interior.Color = vbGreen
    .Font.Color = vbWhite
    End With

    With cond2
    .Interior.Color = vbRed
    .Font.Color = vbWhite
    End With

    With cond3
    .Interior.Color = vbYellow
    .Font.Color = vbRed
    End With

    End Sub

  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,954

    Re: conditional formatting with formula in cell

    Matierk welcome to the forum

    Administrative Note:

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

    (also, please add code tags to you post, my signature explains how to do that)

  6. #6
    Registered User
    Join Date
    02-09-2020
    Location
    vienna
    MS-Off Ver
    office 365
    Posts
    5

    Re: conditional formatting with formula in cell

    sorry for the late reply - the email went straight into junk and i did not realise.

    hmm this is what i thought that i would need to use VBA.. it is unfortunate there is not an "evaluate" function so to evaluate any kind of text formula within the conditional formatting.
    i actually will not need the various brands in the future so i think i will be fine for now - thanks though!

+ 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. [SOLVED] Conditional Formatting Formula - if cell A = or > or <
    By RuthieBuxton in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-25-2018, 08:31 AM
  2. [SOLVED] Conditional formatting when there is a formula in the cell
    By Icehockey44 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-14-2016, 10:12 AM
  3. Replies: 3
    Last Post: 06-19-2015, 07:16 AM
  4. Conditional formatting if cell contains a formula
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2014, 02:18 PM
  5. Conditional Formatting if cell contains formula
    By brokenbiscuits in forum Excel General
    Replies: 3
    Last Post: 07-26-2014, 01:45 AM
  6. [SOLVED] Conditional formatting a cell containing a formula
    By Nigel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-10-2014, 05:58 AM
  7. Conditional formatting a cell containing a formula
    By Nigel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2014, 04:40 AM

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