+ Reply to Thread
Results 1 to 4 of 4

Entering Code for [If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is white]

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Entering Code for [If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is white]

    Hi there,
    I have a situation and I need help.
    Pardon my English for it is my second language.

    Situation:
    Given (23R x 4C) x 1000 where each cell contain random numbers and only two (2) background color (yellow and green).
    I need a solution (code or any resolution) to all of these conditions:

    Conditions:
    1. If cell (a1) is yellow, cell (a2:a4) is white then cell (a1:a4) is white.
    2. If cell (a1) is white, cell (a2) is yellow, cell (a3:a4) is white then cell (a2:a4) is white.
    3. If cell (a1:a2) is white, cell (a3) is yellow, then cell (a1:a4) is white.
    4. If cell (a1:a3) is white and cell (a4) is yellow then cell (a1:a4) is white.
    5. If cell (a1:a2) is yellow then cell (a1:a4) remain the same color.
    6. If cell (a1) is yellow, cell (a2) is white, cell (a3) is yellow then cell (a1:a4) remain the same color.
    7. If cell (a1) is yellow, cell (a2:a3) is white and cell (a4) is yellow then cell (a1:a4) remain the same color.
    8. If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is white then cell (a1:a4) remain the same color.
    9. If cell (a1) is white, cell (a2) is yellow, cell (a3) is white and cell (a4) is yellow then cell (a1:a4) remain the same color.
    10. If cell (a1:a2) is white and cell (a3:a4) is yellow then cell (a1:a4) remain the same color.
    11. If cell (a1:a3) is yellow then cell (a1:a4) remain the same color.
    12. If cell (a2:a3) is yellow, cell (a3) is white and cell (a4) is yellow then cell (a1:a4) remain the same color.
    13. If cell (a1) is yellow, cell (a2) is white and cell (a3:a4) is yellow then cell (a1:a4) remain the same color.
    14. If cell (a1) is white and cell (a2:a4) is yellow then cell (a1:a4) remain the same color.
    15. If cell (a1:a4) is yellow then cell (a1:a4) remain the same color.

    (Take note that all of these conditions are in yellow and white background)

    Reverse Situation: Another condition is taking the entire conditions above and changing yellow to green and the results are the same which is: cell (a1:a4) remain the same color.

    16. If cell (a1) is yellow and cell (a2) is green then cell (a1:a4) remain the same color
    17. If cell (a1) is yellow, cell (a2) is white, cell (a3) is green and cell (a4) is white then cell (a1:a4) remain the color.
    18. If cell (a1) is yellow, cell (a2:a3) is white and cell (a4) is green then cell (a1:a4) remain the same color.
    19. If cell (a1) is white, cell (a2) is yellow, cell (a3) is green and cell (a4) is white then cell (a1:a4a) remain the same color.
    20. If cell (a1) is white, cell (a2) is yellow, cell (a3) is white and cell (a4) is green then cell (a1:a4) remain the same color.
    21. If cell (a1) is green, cell (a2) is yellow and cell (a3:a4) is white then cell (a1:a4) remain the same color.
    22. If cell (a1:a2) is white, cell (a3) is yellow and cell (a4) is green then cell (a1:a4) remain the same color.
    23. If cell (a1) is green, cell (a2) is white, cell (a3) is yellow and cell (a4) is white then cell (a1:a4) remain the same color.
    24. If cell (a1) is white, cell (a2) is green, cell (a3) is yellow and cell (a4) is white then cell (a1:a4) remain the same color.
    25. If cell (a1) is green, cell (a2:a3) is white and cell (a4) is yellow then cell (a1:a4) remain the same color.
    26. If cell (a1) is white, cell (a2) is green, cell (a3) is white and cell (a4) is yellow then cell (a1:a4) remain the same color.
    27. If cell (a1:a2) is white, cell (a3) is green and cell (a4) is yellow then cell (a1:a4) remain the same color.
    28. If cell (a1:a2) is yellow, cell (a3) is green and cell (a4) is white then cell (a1:a4) remain the same color.
    29. If cell (a1:a2) is yellow, cell (a3) is white and cell (a4) is green then cell (a1:a4) remain the same color.
    30. If cell (a1) is yellow, cell (a2) is white, cell (a3) is yellow and cell (a4) is green then cell (a1:a4) remain the same color.
    31. If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is green then cell (a1:a4) remain the same color.
    32. If cell (a1) is green, cell (a2) is white, cell (a3:a4) is yellow then cell (a1:a4) remain the same color.
    33. If cell (a1) is yellow, cell (a2) is green, cell (a3) is white and cell (a4) is yellow then cell (a1:a4) remain the same color.
    34. If cell (a1:a3) is yellow and cell (a4) is green then cell (a1:a4) remain the same color.
    35. If cell (a1:a2) is yellow, cell (a3) is green and cell (a4) is yellow then cell (a1:a4) remain the same color.
    36. If cell (a1) is yellow, cell (a2) is green and cell (a3:a4) is yellow then cell (a1:a4) remain the same color.
    37. If cell (a1) is green and cell (a2:a4) is yellow then cell (a1:a4) remain the same color.

    Reverse Situation: Another condition is taking the entire conditions above and interchange the two different color (yellow to green) and the result is the same which is: cell (a1:a4) is white.

    I hope to make things clearer, I have attached a Microsoft Excel file for you to identify the problems.
    Attached Files Attached Files

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Entering Code for [If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is whit

    why are the cells coloured? what makes a cell yellow?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Entering Code for [If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is whit

    im not sure about 2010, but (i use) 2007 has no way of conditional formatting based on color, and in fact, apart from VBA, it cannot recognize color through formulas at all
    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
    07-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Entering Code for [If cell (a1) is white, cell (a2:a3) is yellow and cell (a4) is whit

    hi martindwilson,
    Thanks for the reply.

    Base on the Microsoft Excel file that I have attached, let just say that I make the cell colored.

    For cell which contain digit one (1), the background color will be yellow
    For cell which contain digit two (2), the background color will be green.

    Hopefully it make sense.

+ 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