+ Reply to Thread
Results 1 to 11 of 11

Q: Conditional formatting

Hybrid View

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    6

    Q: Conditional formatting

    Not sure how to make the title more descriptive.. sorry...
    Not new to Excel but have always used it for straight number-crunching.

    I have a list of 15 values stored on sheet 3 in a column; for this purpose call them products. Each product is formatted (background color and font) the way I want it to always appear. That is, if "widget" appears somewhere in the spreadsheet I want that cell to match how the cell containing "widget" appears on Sheet 3. I understand that this won't happen automagically; the cell containing "widget" has to have conditional formatting applied. It's HOW to set up the conditional formatting that is throwing me for a loop. It's a lookup for a format based on value.

    I've only ever used simple conditional formatting in the past (if value<0 then background is red, for instance) but this is beyond what I can see how to do. Thanks in advance for any assistance.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,082

    Re: Q: Conditional formatting

    VBA would be the answer here as formulas cant tell the colour/format of a cell but VBA can.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    09-20-2013
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    6

    Re: Q: Conditional formatting

    Perhaps I didn't explain it well since your answer (which I do appreciate you taking the time) doesn't match what I'm doing.

    In pseudo-code:
    If content of CellA matches a cell content in columnX on sheet 3 format CellA to match the format of the matched cell on sheet 3

    I'm not trying to lookup formats; looking up data and formatting based on the value found

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Q: Conditional formatting

    Quote Originally Posted by Danich View Post
    I'm not trying to lookup formats; looking up data and formatting based on the value found
    It sounds like you ARE looking up the format.

    In pseudo-code: ...to match the format of the matched cell on sheet 3
    Or, perhaps you could give use some examples so we can better understand what you want to do.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    09-20-2013
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    6

    Re: Q: Conditional formatting

    Fair enough...
    As stated there is a list (which is static and will never change) on sheet 3 of products (widget, left-handed scissors, etc). Each cell is formatted a specific way (not real involved: background color and font).
    On Sheet 1 (for instance) I input "widget" in a cell. When I hit enter I want this cell to match the formatting found on Sheet 3 for "widget." So if "widget" on sheet 3 has a yellow background and bold font, the cell containing "widget" on Sheet 1 should format to a yellow background with bold font.
    So far not bad but the cell taking the input could take any of the 15 products so it needs a lookup on the value "widget." Doing a lookup to match a value is simple; it's copying the formatting that's got me puzzled.
    To emphasize: what is being matched is cell content (widget) not cell formatting (which, as Special-K said, is not possible). It's "find X in this location, if match=true then do Y to the cell containing X based on the cell where the match was found"
    Better?
    Thank you for your time!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Q: Conditional formatting

    If the cells in your product list use conditional formatting then you can use that same conditional formatting in your lookup cell. Otherwise, this can not be done without VBA.

  7. #7
    Registered User
    Join Date
    09-20-2013
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    6

    Re: Q: Conditional formatting

    Okay... I want to avoid VBA if possible. More complexity than I want to deal with (not to mention whoever comes after me).
    So, what you're saying is is to use conditional formatting to format the static list on Sheet 3. So each cell would be "if <content> = <product>" format as ABC.
    With each cell using a different <content> and <product> (both of which are equal).
    Then.... what? Will it automatically carry over to the input cell on Sheet 1 on match=true?

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Q: Conditional formatting

    Let's assume Sheet3 A1 = Product1

    You set conditional formatting on this cell to use a green fill:

    Home tab>Conditional Formatting>Manage rules>New rule>Use a formula to determine which cells to format

    Formula: =A1="Product1"

    Click the Format button
    Select the Fill tab>select a shade of green>OK out

    On some other sheet in cell A1 you might enter Product1.

    Apply the same conditional formatting rules to this cell as you did to the cells on Sheet3.

  9. #9
    Registered User
    Join Date
    09-20-2013
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    6

    Re: Q: Conditional formatting

    Okay, I can see that.
    Yet there are 15 products that could be entered in any order, at any time, on Sheet1. The column in which it could be entered is a static value (specifically C2:C25) AND it can change to any of the 15 products. If "widget" has a yellow background and "scissors" is a green background: enter widget in Sheet1 in that range and on enter the background should go yellow. Go back later and change it to "scissors" and on enter the background should change to green. But it's BASED on the format that exists on Sheet3; next month the background for "widget" may be defined as blue. Ideally I should be able to go to Sheet3, change that one rule to blue and all instances of "widget" get a blue background.
    To put it another way: forget formats and focus on the cells containing numbers that are referenced in formulas elsewhere. If I change one of those numbers all cells using formulas that reference that modified cell will change their contents.
    I feel like the answer is just inches away but I can't see it.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Q: Conditional formatting

    Formulas can only return a value to a cell. It can be 1 of 4 types of values:

    A text value like "Yes"

    A numeric value like 100

    A logical value like TRUE or FALSE

    Or an error value like #N/A

    That's it. That's all a formula can do. A formula can not "pull" formatting from another cell.

    So, without using VBA, the only way to do what you want is to apply the same conditional formatting to both locations.

  11. #11
    Registered User
    Join Date
    09-20-2013
    Location
    Dallas, TX
    MS-Off Ver
    2010
    Posts
    6

    Re: Q: Conditional formatting

    Hmm... then I misunderstand the purpose of the last selection when setting up Conditional Formatting. To wit: "Use a formula to determine which cells to format"

+ 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: 2
    Last Post: 09-19-2013, 10:34 AM
  2. Conditional Formatting via VBA: Change formatting in range based on value of each cell
    By ralphjmedia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2013, 10:37 AM
  3. Delete Conditional Formatting conditions but keep cell formatting - Excel 2010
    By tetreama in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-09-2012, 08:28 PM
  4. Replies: 3
    Last Post: 05-15-2012, 04:13 PM
  5. Macro for formatting fonts and cell colours - not Conditional Formatting
    By Kayaness in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-07-2011, 03:46 AM

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